SQL Cheat Sheet

List all rows in a table:

SELECT * FROM table_name;

List specific columns in a table:

SELECT column1, column2 FROM table_name;

Filter rows using a WHERE clause:

SELECT * FROM table_name WHERE condition;

Update rows in a table:

UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;

Insert rows into a table:

INSERT INTO table_name (column1, column2) VALUES (value1, value2);

Delete rows from a table:

DELETE FROM table_name WHERE condition;

Create a backup of a table:

SELECT * INTO backup_table_name FROM table_name;


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *