打开
1. 增
INSERT INTO users(username,pwd,age) VALUES("李四",123,19)
INSERT INTO users(username,pwd,age) VALUE ("张三",123,12)
INSERT INTO users(username,pwd,age) VALUES ("王二1",1,1);
INSERT INTO users(username,pwd,age) VALUES ("王二2",1,1);
INSERT INTO users(username,pwd,age) VALUES ("王二3",1,1);
INSERT INTO users(username,pwd,age) VALUES ("王二4",1,1);
INSERT INTO users(username,pwd,age) VALUES ("王二5",1,1);
INSERT INTO users(username,pwd,age) VALUES ("王二6",1,1)
2. 删除
DELETE FROM users WHERE username="张三"
DELETE FROM users WHERE id=1 or id=4
DELETE FROM users WHERE id IN(5,6,7)
AND
BETWEEN AND
OR
ONT
3.修改
UPDATE 表名 SET 设置的内容 WHERE 加条件语句
UPDATE users SET username="张三",pwd=321 WHERE id=3
4.查询
SELECT * FROM `users` WHERE 1
SELECT * FROM `users` WHERE username LIKE "李%"
SELECT * FROM `users` WHERE username LIKE "张%" AND age=12
5.分页查询
SELECT * FROM `users` LIMIT 2,2//第二条数据,查三条
6.倒序排列
SELECT * FROM `users` ORDER BY id DESC
7.统计条数
SELECT COUNT(*) FROM users
8.联表查询
将两张表连在一起进行查询
SELECT * FROM 表名1 JOIN 表名2
SELECT * FROM users JOIN product ON users.id=product.id;
9.简写
SELECT * FROM `users` AS u JOIN product AS p ON u.id=p.id
10.以左边为主表
SELECT * FROM `users` AS u LEFT JOIN product AS p ON u.id=p.id