首页 > 数据库技术 > 详细

数据库

时间:2020-05-14 19:36:01      阅读:39      评论:0      收藏:0      [点我收藏+]

列标签

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  

 

数据库

原文:https://www.cnblogs.com/iamAngelo/p/12890634.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!