Logo  

CS479/579 - Web Programming II

Displaying ./code/SQL/sql-commands.txt

Create
 - insert command
 INSERT INTO tablename (`col1`, `col2`) VALUES ('A', 1), ('B', 2)...;

 INSERT INTO tablename SET col1='A', col2='B';

Read
 - select command

Update
  UPDATE tablename SET col2=col2+50 WHERE col1=1;

 - update command

Delete
 - delete command
  delete from tablename where id < 30 limit 10 returning id;

Misc:
 - lock tables

 lock tables tablename read;
 or:
 lock tables tablename write;
 ...
 unlock tables;