db5查询表中的数据.pptx

db5查询表中的数据创新

复习;数据查询;什么是查询?;怎么查的?;SQL语法;查询记录操作;查询举例;举例1 : 查询全体学生的学号与姓名。 select sno,sname from student; 举例2 : 查询全体学生的详细记录。 select sno,sname,ssex,sage,sdept from student; 或select * from student; 举例3 : 查全体学生的姓名及其出生年份。 select sname,2008-sage from student;? 举例4 : 查询全体学生的姓名、出生年份和所有系,要求用小写字母表示所有系名。 select sname,year of birth: ,2008-sage, islower(sdept) from student; 举例5 : 查询选修了课程的学生学号(去掉重复的记录) select distinct studentid from sc;;举例6 : 查询全体学生的学号与姓名,用中文显示列名。 select sno as ‘编号’,sname as ‘姓名’ from student; 举例7 : 给表设置别名。 select s.sno,s.sname from student as s; 举例8 : 查询年龄在20以下的学生的姓名。 select sname fro

文档评论(0)

1亿VIP精品文档

相关文档