mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-03 15:40:17 +00:00
28 lines
630 B
Plaintext
28 lines
630 B
Plaintext
-- Insert a new row into a table
|
|
INSERT INTO table(column1,column2,...)
|
|
VALUES(value_1,value_2,...);
|
|
|
|
-- Insert multiple rows into a table
|
|
INSERT INTO table_name(column1,column2,...)
|
|
VALUES(value_1,value_2,...),
|
|
(value_1,value_2,...),
|
|
(value_1,value_2,...)...
|
|
|
|
-- Update data for all rows
|
|
UPDATE table_name
|
|
SET column_1 = value_1,
|
|
...;
|
|
|
|
-- Update data for a set of rows specified by a condition in WHERE clause
|
|
UPDATE table
|
|
SET column_1 = value_1,
|
|
...
|
|
WHERE condition;
|
|
|
|
-- Delete all rows of a table
|
|
DELETE FROM table_name;
|
|
|
|
-- Delete specific rows based on a condition
|
|
DELETE FROM table_name
|
|
WHERE condition;
|