- 1、本文档共21页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
SQLscript - 副本
Create table S
(Sno char(9) primary key,
Sname varchar(20) not null,
Ssex char(2),
Sage smallint,
Sdept char(2)) ;
Create table C
(Cno varchar(2) primary key,
Cname varchar(20) not null,
Cpno varchar(2),
Ccredit smallint) ;
Create table SC
(Sno char(9),
Cno varchar(2),
Grade smallint,
primary key (Sno, Cno),
foreign key (Sno) references S(Sno),
foreign key (Cno) references C(Cno) ) ;
DESC S;
alter table S modify (sname varchar(8));
alter table S drop (sdept);
alter table S add (sdept char(2));
drop table SC;
drop table S;
drop table C;
CREATE INDEX S_AGE ON S(SAGE);
DROP INDEX S_AGE;
INSERT INTO S VALUES(200215121,李勇,男, 20 ,CS);
INSERT INTO S VALUES(200215122,刘晨,女, 19 ,CS);
INSERT INTO S VALUES(200215123,王敏,女, 18 ,MA);
INSERT INTO S VALUES(200215125,张立,男, 19 ,IS);
INSERT INTO C VALUES(1,数据库,5, 4);
INSERT INTO C VALUES(2,数学,null, 2);
INSERT INTO C VALUES(3,信息系统,1,4);
INSERT INTO C VALUES(4,操作系统,6,3);
INSERT INTO C VALUES(5,数据结构,7,4);
INSERT INTO C VALUES(6,数据处理,null,2);
INSERT INTO C VALUES(7,PASCAL语言,6,4);
INSERT INTO SC VALUES(200215121,1, 92);
INSERT INTO SC VALUES(200215121,2, 85);
INSERT INTO SC VALUES(200215121,3, 88);
INSERT INTO SC VALUES(200215122,2, 90);
INSERT INTO SC VALUES(200215122,3, 80);
create index sind on s(sage);
create unique index sind2 on s(sname desc);
drop index sind2 ;
select sno , sname from s ;
select sname, sno , sdept from s ;
select * from s ;
select sname, 2012 - sage as birthyear from s ;
select sno from sc;
select distinct sno from sc;
select all sno from sc;
select sname from s where sdept= CS;
select sname,sage from s where sage20;
select sname,sdept,sage from s where sage between 20 and 23 ;
select sname,sdept,sage from s where sage not between 20 and 23 ;
select sname,sdept,sage from s where sage 20 or sage 23 ;
select sname, ssex from s where sdept in (CS, MA, IS) ;
select sname, ssex from s where sdept not in (CS, MA, IS) ;
select sname, sno,ssex from s where sname like 刘%;
select * from c where cname like 数据__ ;
sele
您可能关注的文档
最近下载
- 基于51单片机的智能台灯设计.doc
- 幼儿园课件:小老鼠和泡泡糖最终.pptx
- 2024必威体育精装版国开《个人理财》形考题库.docx VIP
- 国家开放大学学前教育专业+毕业作业(幼儿园教学活动设计与指导)9.doc
- 第18课 从九一八事变到西安事变(课件).pptx VIP
- 酒店装配式装修技术规程.pdf VIP
- 2023年中国汉字听写大赛全部试题库及答案.pdf VIP
- 2024中国铁路成都局集团限公司招聘高校毕业生998人高频考题难、易错点模拟试题(共500题)附带答案详解.docx
- 人文英语3--An-absence-excuse-letter完整版.docx
- 神经工程学(天津大学)大学MOOC慕课 客观题答案.docx
文档评论(0)