数据库系统原理与设计——投影运算、选择运算
admin
2023-02-08 06:00:04
0

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

数据库版本: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

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



相关内容

热门资讯

最新引进“白金岛跑胡子.怎么开... 最新引进“白金岛跑胡子.怎么开挂?”太坑了原来有挂您好,白金岛跑胡子这个游戏其实有挂的,确实是有挂的...
今日重大发现“开心游戏.是不是... 有 亲,根据资深记者爆料开心游戏是可以开挂的,确实有挂(咨询软件无需打开...
我来教教您“麻友圈2.怎么装挂... 网上科普关于“麻友圈2有没有挂”话题很是火热,小编也是针对麻友圈2作*弊开挂的方法以及开挂对应的知识...
最新引进“长虹大厅.是不是有挂... 您好:长虹大厅这款游戏可以开挂,确实是有挂的,需要了解加客服微信【4282891】很多玩家在这款游戏...
今日重大通报“旺旺冲击麻将.有... 家人们!今天小编来为大家解答旺旺冲击麻将透视挂怎么安装这个问题咨询软件客服徽9752949的挂在哪里...
重磅消息“蜀山四川麻将.到底有... 有 亲,根据资深记者爆料蜀山四川麻将是可以开挂的,确实有挂(咨询软件无需...
火箭发射高度活跃 产业链上市公... 本报记者 丁蓉 近日,火箭发射活动十分密集。12月13日,快舟十一号遥八运载火箭在酒泉卫星发射中心发...
终于明白“边锋老友麻将.究竟有... 家人们!今天小编来为大家解答边锋老友麻将透视挂怎么安装这个问题咨询软件客服徽9752949的挂在哪里...
【第一财经】“丫丫古诗.辅助器... 家人们!今天小编来为大家解答丫丫古诗透视挂怎么安装这个问题咨询软件客服徽4282891的挂在哪里买很...
我来教教您“新永和牛牛.开挂器... 有 亲,根据资深记者爆料新永和牛牛是可以开挂的,确实有挂(咨询软件无需打...