Skip to content

List all foreign keys PostgreSQL

I need a query that returns: “table_name”, “field_name”, “field_type”, “contraint_name” until now i have: Answer A foreign key may be based on multiple columns, so conkey and confkey of pg_constraint are arrays. You have to unnest the arrays to get a list of column names or types. You can use these functions: The functions may be very handy when querying

Copy DAO recordset from Excel into Access table

I have searched endlessly for a solution to this but can’t figure it out at all. Any help would be massively appreciated. I currently have some Access VBA code which sets up a DAO recordset connection with a range in an excel worksheet. (I have avoided linking the spreadsheet as a linked table as I am unsure if you can

sql stored function gives an error

I am trying to create a stored function to take one parameter called budget. The function should return the string ‘LOW’ for a budget less than or equal to 500000, ‘MID’ for a budget less than or …

Postgres Left Join with where condition

I need to left join two tables with a where condition: time_table record_table I need to get all those records which are present under given date range. In the above example, I need those records that lie under range for rid = 2 only. Hence the output for the above query needs to be: Answer left join two tables with

How to find List Tables using columns value

I have 500+ tables in database. All tables have several columns. Among them Some tables have ‘CMDFLAG’ column and value of the columns may have ‘C’or’D’ or ‘M’. My requirement is to find the list of …

Select from 2 tables with conditions

I need a SQL query, for multiple condition select from 2 tables. I want to get all rows so that I get all order_row rows from table2 which are not present in table1 and order_row rows from table2 whose timestamp is newer in table2 than table1. And checks only rows from table 2 where timestamp is newer than 2016-11-03. Result

Kind of cross join query with filtering

I have following three tables: dbo.Product Id | Name 1 | P1 2 | P2 dbo.ProductTranslations Id | LangId | Text 1 | 1 | Text_EN 1 | 2 | Text_DE 2 | 1 | …

ADODB Connection to two access database

Due to ms access 2GB limitations on space; i am considering splitting a database into two. However I regularly rely on SQL statements such as the following: Is there a way in ADODB to perform the above, ie INSERT INTO table in file 1, the SELECT data from a table in file 2 ? Answer Here’s an example of updating