How to use the result of an insert as foreign key in another insert?
1017
Is MySql's LAST_INSERT_ID() function guaranteed to be correct?
8616
Insert into select and update in single query
27642
Insert if not exists, else return id in postgresql
87556
How can I list all foreign keys referencing a given table in SQL Server?
24398
SqlServer: can one table's PK be the FK of two table's?
125581
Re-use aliased field in SQL SELECT statement
64483
Inserting into related tables
110522
Insert, on duplicate update in PostgreSQL?
35704
How do you join on the same table, twice, in mysql?
7693
How do I add a foreign key to an existing SQLite table?
20394
Renaming foreign-key columns in MySQL
18575
How to 'insert if not exists' in MySQL?
43205
use result set of mysql stored procedure in another stored procedure
88609
Insert result of a parallellized select query into a table, in Postgresql
93487
SQL, How to Concatenate results?
38371
How to UPSERT (MERGE, INSERT ... ON DUPLICATE UPDATE) in PostgreSQL?
41922
MySQL SELECT LAST_INSERT_ID() for compound key. Is it possible?