1、创建数据库
sql
CREATE DATABASE database_name;
2、删除数据库:
sql
DROP DATABASE database_name;
3、使用数据库:
sql
USE database_name;
4、创建表:
sql
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
...
);
5、删除表:
sql
DROP TABLE table_name;
6、插入数据:
sql
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
7、更新数据:
sql
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
8、删除数据:
sql
DELETE FROM table_name
WHERE condition;
9、查询数据:
sql
SELECT column1, column2, ...
FROM table_name
WHERE condition;
10、查询数据并排序:
sql
SELECT column1, column2, ...
FROM table_name
WHERE condition
ORDER BY column_name ASC/DESC;
11、查询数据并限制结果数量:
sql
SELECT column1, column2, ...
FROM table_name
WHERE condition
LIMIT num;
12、连接多个表查询:
sql
SELECT column1, column2, ...
FROM table1
JOIN table2 ON condition;