SQL Reference / Cheatsheet

SQL Reference / Cheatsheet

Last updated:

Inserting data into a table

only actual fields need be stated (AUTO-INCREMENT fields shouldn't be included, and NULL fields can be omitted).

INSERT INTO <TBL_NAME>(field1,field2,field3) VALUES('value1','value2',42)

Inserting from select

INSERT INTO <TBL_NAME>(field1,field2,field3) SELECT field1,field2,field3 FROM <OTHER_TBL_NAME>