数据库

列标签

select id,name from student;

select id as '学号',name as '姓名' from student;(只是修改结果)

排序

select * from student where sex='1'

order by sno asc,sname desc

ps:ASC正序排序;DESC逆序排序

IN、LIKE、IS NULL

select * from student 

where id IN('2020001','2020002','2020003')

where id NOT IN('2020001','2020002','2020003')

------------------------------------------------------------------

select * from student 

where phone IS NULL

select * from student 

where phone IS NOT NULL

------------------------------------------------------------------

select * from student where sname LIKE '张%'

-----------------------------------------------------------------

ps:‘%’是通配符

常用函数

selece * from student where year(birthday)>=1980

and year(birthday)<1990

注:查询90后的信息

select max(id) from student

表的关联

SELECT stu.sname,stu.sage,stu.sno,sc.sno,sc.score
FROM student stu,score sc  //起别名
WHERE stu.sno=sc.sno  

 

上一篇:2016.07.09 offsetWidth 和一个问题。


下一篇:Oracle 窗口函数 实例操做 放大招