分页查询 limit
SELECT * FROM employees LIMIT 0,5;
# 从0开始,可省略起始索引
SELECT * FROM employees LIMIT 5
联合查询
插入语句 insert into
#方式一:
INSERT INTO beauty(NAME,sex,`phone`) VALUE('徐凤年','男','13825425632');
#支持插入多行
INSERT INTO beauty(NAME,sex,phone)
VALUE('徐凤年1','男','13825425632'),
('徐凤年2','男','13825425632'),
('徐凤年3','男','13825425632')
#支持子查询
INSERT INTO beauty(NAME,sex,phone)
SELECT `boyName`,'男','1654616516'
FROM boys
#方式二
INSERT INTO beauty SET NAME = '陈芝豹',sex = '男',phone = '13654875896';
修改语句 update
#修改多表记录
#内联实现
UPDATE beauty b
JOIN boys bo
ON b.`boyfriend_id` = bo.`id`
SET b.`phone` = '114'
WHERE bo.`boyName` = '张无忌';
#左联实现
UPDATE beauty b
LEFT JOIN boys bo
ON b.`boyfriend_id` = bo.`id`
SET b.`boyfriend_id` = 2
WHERE bo.`id` IS NULL
删除语句 delete from
#单表的删除
DELETE FROM beauty WHERE `phone` LIKE '%9';
#多表的删除
#单表
DELETE b FROM beauty b
JOIN boys bo
ON b.`boyfriend_id` = bo.`id`
WHERE bo.`boyName` = '张无忌';
#双表
DELETE b,bo FROM beauty b
JOIN boys bo
ON b.`boyfriend_id` = bo.`id`
WHERE bo.`boyName` = '黄晓明';