SQL is a standardized computer language used to operate relational databases. The data manipulation language part of SQL allows to find, add, modify or delete data in relational databases
Request | Description |
INSERT INTO table_name (column1, column2, column3, …) VALUES (value1, value2, value3, …); | The INSERT INTO statement is used to insert new records in a table. |
INSERT IGNORE INTO table_name (column1, column2, column3, …) VALUES (value1, value2, value3, …); | The INSERT IGNORE INTO statement is used to insert new records in a table, without modifying the already existing records. |
DELETE FROM table_name WHERE condition; | The DELETE FROM statement is used to delete existing records in a table, according to a given condition. |
UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition; | The UPDATE statement is used to modify the existing records in a table, according to a given condition. |
SELECT column1, column2, … FROM table_name ORDER BY column1 ASC; | The ORDER BY keyword sorts the records in ascending ASC order by default. To sort the records in descending order, use the DESC keyword. |
DROP DATABASE myDataBase; | The DROP DATABASE request is used to delete a database. Be careful while using it. |
DROP TABLE my_table; | The DROP TABLE request is used to delete a table, without looking if there is data in it. Be careful while using it. |
CREATE TABLE Shnapshnoot ( ID int NOT NULL, Username varchar(255) NOT NULL, password varchar(255), Age int, PRIMARY KEY (ID) ); | The CREATE TABLE request is used to create a table in a database. The PRIMARY KEY keyword uniquely identifies each record in a table. Primary keys must contain UNIQUE values, and can not contain NULL values. Each tables can have only ONE primary key. |
SELECT COUNT(*) FROM table_name WHERE condition; | The COUNT() function returns the number of rows that matches your given condition. |