资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

数据库系统原理与设计——投影运算、选择运算

书籍:数据库系统原理与设计(第3版)——万常选 廖国琼等编著

创新互联成立于2013年,是专业互联网技术服务公司,拥有项目做网站、成都网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元无极做网站,已为上家服务,为无极各地企业和个人服务,联系电话:18980820575

数据库版本:SQL Server 2005

/*

select courseNO as 课程号,lower(coursename) 课程名,courseHour/16 as 周课时

from course

*/

/*  --”%任意字符","_"通配符的使用

select *

from class

where className  like '%会计%'

select studentNo,studentName

from Student

where studentName like '王__'

select studentNo,studentName

from Student

where studentName not like '%福%'

select studentNo,studentName,nation

from Student

where nation  not like '蒙古族'

select studentNo,studentName,nation

from Student

where nation like '蒙古族' 

*/

--通配符的使用

/*

select className

from class

where className like '%16\_%' ESCAPE '\'

union

select className

from class

where className like '%16\_%'  --不对

union

select className

from class

where className like '%16_%' ESCAPE '\'  --不对

*/

--转义字符的使用,以下两种方法相似

/*

select className

from class

where className like '%16#_%' escape '#'

select className

from class

where className like '%16\_%' ESCAPE '\'

*/

/* --学会逻辑运算符or  and 

select studentNo,courseNO,score

from score

where courseNo='001' or courseNo='005' or courseNo='003'

select studentNo,courseNO,score

from score

where courseNo='001' and  courseNo='003'

select studentNo,courseNO,score

from score

where courseNo in('001','005','003')

*/

/*

select studentNO as 学号,studentName as 姓名 ,year(birthday) as 出生年份

from Student

where year(birthday)=1998 and nation='汉族'

*/

/*  --籍贯不在南昌和上海的,两种实施方法,二选一

select studentNO as 学号,studentName as 姓名 ,native

from Student

where native not in ('南昌','上海')

select studentNO as 学号,studentName as 姓名 ,native

from Student

where  native!='南昌' and native!='上海'

*/

/*  80——90区间的分数

select studentNo,courseNO,score

from score

where  score>=80 and  score<=90

select studentNo,courseNO,score

from score

where  score between 80 and 90

*/

/*

select studentNo,courseNO,score

from score

where score<80 or score>90

*/

/*

--按籍贯排序

select studentName,native,classNo

from student

where native!='南昌' and native!='上海'

order by native desc 

*/

该教材相关资料请点击如下链接:

https://blog.51cto.com/sky9896/2323447

http://down.51cto.com/data/2456174

实战技巧:完成一个任务,可以使用两种方法来完成。


当前题目:数据库系统原理与设计——投影运算、选择运算
URL标题:http://cdkjz.cn/article/gedjjj.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220