AI智能
改变未来

MYSQL秘籍

Mysql语句复习

基础查询:
select * from employees

条件查询:
select * from employees where last_name=‘king’

模糊查询+排序查询:
select * from employees where last_name like ‘_e%’
order by length(email)desc

分组查询:
select max(salary)maxsalary from employees
group by department_id
having maxsalary > 3000

分组函数:
min max avg sum count

等值连接查询:
select* from employees e,departments d
where e.department_id = d.department_id

内连接查询:
select* from employees e inner join departmengts d
on e.department_id = d.department_id

单行子查询:
select * from employees
where department_id = (

)

多行子查询:
select * from employees
where department_id in (

)

分页查询:
select * from employees limit 10

插入数据:(两种方法)
insert into employees values (),(),()
或者
insert into employees
select …UNION
select …UNION
select …

更新数据:
update employees set …where

删除:
delete from employees where
(truncate )不常用

快捷键:
window+D // 回到桌面
window+E //打开我的电脑
window+P //投影扩展屏

赞(0) 打赏
未经允许不得转载:爱站程序员基地 » MYSQL秘籍