码迷,mamicode.com
首页 > 数据库 > 详细

数据库

时间:2020-05-14 19:47:20      阅读:76      评论:0      收藏:0      [点我收藏+]

标签:数据库   常用函数   name   strong   标签   排序   null   core   rom   

列标签

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  

 

数据库

标签:数据库   常用函数   name   strong   标签   排序   null   core   rom   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!