ImageVerifierCode 换一换
格式:DOC , 页数:19 ,大小:588KB ,
资源ID:9457433      下载积分:10 金币
验证码下载
登录下载
邮箱/手机:
图形码:
验证码: 获取验证码
温馨提示:
支付成功后,系统会自动生成账号(用户名为邮箱或者手机号,密码是验证码),方便下次登录下载和查询订单;
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/9457433.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请。


权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:4009-655-100;投诉/维权电话:18658249818。

注意事项

本文(数据库SQL实验报告书.doc)为本站上传会员【仙人****88】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

数据库SQL实验报告书.doc

1、 南京理工大学紫金学院 实验报告书 课程名称: 《数据库系统》 实验题目: 实验1 用SQL语句创建数据库和表 班 级: 计算机科学与技术2班 学 号: 09061257 姓 名: 朱书宏 指导教师: 叶庆生 成 绩: 批阅教师

2、 年 月 日 《数据库系统》实验报告 090601257 朱书宏 - 18 - 一、 实验目的 1. 使用SQL2005练习使用SQL语句创建数据库与表 2.练习SQL查询、修改、删除等语句语句 3.掌握数据库中创建表时主键、约束条件的纂写 二 .实验内容 1.根据下列数据库模式,用SQL语句创建一个适当地数据库,并创建相关的表,注意表中的主键和外键及某些属性域的约束。 Product(marker, model, type)

3、 PC(model, speed, ram, hd, rd, price) Laptop(model, speed, ram ,hd, screen, price) Printer(model, color, type, price) 2.根据下列数据库模式,用SQL语句创建一个适当地数据库,并创建相关的表,注意表中的主键和外键及某些属性域的约束。 Classes ( class , type , country , numCuns , bore , displacement ) Ships( name , class , launched

4、) Battles( name , date ) Outcomes ( ship , battle , result ) 3.将相关的数据用SQL语句插入到数据中。 4.基于习题5.2.4给出的数据库模式和数据写出后面的查询语句以及查询结果。 Classes ( class , type , country , numCuns , bore , displacement ) Ships( name , class , launched ) Battles( name , date ) Outcomes ( ship , battle , re

5、sult ) a)找出战舰类型的数量。 b)找出不同类型战舰拥有的平均火炮数量。 !c)找出战舰的平均火炮数量。注意c)和b)的不同在于:在计算均值的时候,是使用战舰的数目还是战舰的类型数目。 !d)找出每一类型( class )的第一艘船下水的年份。 !e)找出每一类型中被击沉船的数目。 !!f) 找出至少有3艘船的类型中被击沉的船的数目。 !!g)军舰火炮使用的炮弹的重量(以磅为单位)大约是火炮的口径(以英寸为单位)的一半。找出各个国家的军舰炮弹重量的平均值。 5.根据习题5.2.1给出的数据库模式,写出下面的数据库修改。描述对该习题数据库修改够的结果。

6、 Product(marker, model, type) PC(model, speed, ram, hd, rd, price) Laptop(model, speed, ram ,hd, screen, price) Printer(model, color, type, price) a) 通过两条INSERT语句在数据库中添加如下信息:制造商C生产的型号为1100的PC,速度为1800,RAM为256,硬盘大小80,具有一个20x的DVD,售价为$2499。 !b) 加入如下信息:对于数据库中每台P

7、C,都对应一台与其速度、RAM、硬盘相同,具有15英寸的屏幕,型号大于1100、价格高于$500的相同厂商制造的手提电脑。 c) 删除所有硬盘不超过20G的PC。 d) 删除所有不制造打印机的厂商生产的手提电脑。 e) 厂商A收购了厂商B,将所有B生产的产品改为由A生产。 f) 对于每台PC,把它的内存加倍并且增加20G的硬盘容量。(记住UPDATE语句中可以同时更改多个属性的值) !g) 把厂商B生产的手提电脑的屏幕尺寸增加一英寸并且价格下调$100。 三、实验步骤 1.创建数据库 表 2. 编写SQL语句 3,

8、在SQL2005上调试语句并运行结果 四、实验结果 1.根据下列数据库模式,用SQL语句创建一个适当地数据库,并创建相关的表,注意表中的主键和外键及某些属性域的约束。 Product(marker, model, type) PC(model, speed, ram, hd, rd, price) Laptop(model, speed, ram ,hd, screen, price) Printer(model, color, type, price) SQL语句: create database [zuoye

9、1] create table product ( marker varchar(16) primary key, model varchar(16) not null, type varchar(16) not null, ) create table PC ( model varchar(16) primary key, speed varchar(16) not null, ram varchar(16) not null, hd varchar(16) not null, rd varchar(16) not null, price int not

10、null ) create table laptop ( model varchar(16) primary key, speed varchar(16) not null, ram varchar(16) not null, hd varchar(16) not null, screem varchar(16) not null, price int not null, ) create table printer ( model varchar(16) primary key, color varchar(16) not null, type varchar

11、16) not null, price int not null, ) 2.根据下列数据库模式,用SQL语句创建一个适当地数据库,并创建相关的表,注意表中的主键和外键及某些属性域的约束。 Classes ( class , type , country , numCuns , bore , displacement ) Ships( name , class , launched ) Battles( name , date ) Outcomes ( ship , battle , result ) SQL语句: create database [

12、zuoye2] create table Classes ( class varchar(16)primary key not null, type varchar(16) not null, country varchar(16) not null, numGuns int, bore int, displacement int, ) create table Ships ( name varchar(16) primary key, class varchar(16) not null, launched varchar(16) not null, ) c

13、reate table Battles ( name varchar(16) primary key, date varchar(16) not null, ) create table Outcomes ( ship varchar(16) primary key, battle varchar(16) not null, result varchar(16) not null, ) 3.将相关的数据用SQL语句插入到数据中。 SQL语句: 数据库1:zuoye1 insert into Product (marker,model,type) values(

14、'A',1001,'pc'); insert into Product (marker,model,type) values('A',1002,'pc'); insert into Product (marker,model,type) values('A',1003,'pc'); insert into Product (marker,model,type) values('A',2004,'laptop'); insert into Product (marker,model,type) values('A',2005,'laptop'); insert

15、 into Product (marker,model,type) values('A',2006,'laptop'); insert into Product (marker,model,type) values('B',1004,'pc'); insert into Product (marker,model,type) values('B',1005,'pc'); insert into Product (marker,model,type) values('B',1006,'pc'); insert into Product (marker,model

16、type) values('B',2007,'laptop'); insert into Product (marker,model,type) values('C',1007,'pc'); insert into Product (marker,model,type) values('D',1008,'pc'); insert into Product (marker,model,type) values('D',1009,'pc'); insert into Product (marker,model,type) values('D',1010,'pc'

17、); insert into Product (marker,model,type) values('D',3004,'printer'); insert into Product (marker,model,type) values('D',3005,'printer'); insert into Product (marker,model,type) values('E',1011,'pc'); insert into Product (marker,model,type) values('E',1012,'pc'); insert into Prod

18、uct (marker,model,type) values('E',1013,'pc'); insert into Product (marker,model,type) values('E',2001,'laptop'); insert into Product (marker,model,type) values('E',2002,'laptop'); insert into Product (marker,model,type) values('E',2003,'laptop'); insert into Product (marker,model,ty

19、pe) values('E',3001,'printer'); insert into Product (marker,model,type) values('E',3002,'printer'); insert into Product (marker,model,type) values('E',3003,'printer'); insert into Product (marker,model,type) values('F',2008,'laptop'); insert into Product (marker,model,type) values('

20、F',2009,'laptop'); insert into Product (marker,model,type) values('G',2010,'laptop'); insert into Product (marker,model,type) values('H',3006,'printer'); insert into Product (marker,model,type) values('H',3007,'printer'); insert into PC (model,speed,ram,hd,price) values(1001,2.66,102

21、4,250,2114); insert into PC (model,speed,ram,hd,price) values(1002,2.10,512,250,995); insert into PC (model,speed,ram,hd,price) values(1003,1.42,512,80,478); insert into PC (model,speed,ram,hd,price) values(1004,2.80,1024,250,649); insert into PC (model,speed,ram,hd,price) values(100

22、5,3.20,512,250,630); insert into PC (model,speed,ram,hd,price) values(1006,3.20,1024,320,1049); insert into PC (model,speed,ram,hd,price) values(1007,2.20,1024,200,510); insert into PC (model,speed,ram,hd,price) values(1008,2.20,2048,250,770); insert into PC (model,speed,ram,hd,price)

23、 values(1009,2.00,1024,250,650); insert into PC (model,speed,ram,hd,price) values(1010,2.80,2048,300,770); insert into PC (model,speed,ram,hd,price) values(1011,1.86,2048,160,959); insert into PC (model,speed,ram,hd,price) values(1012,2.80,1024,160,649); insert into PC (model,speed,r

24、am,hd,price) values(1013,3.06,512,80,529); insert into Printer (model,color,type,price) values(3001,'true','ink-jet',99); insert into Printer (model,color,type,price) values(3002,'false','laser',239); insert into Printer (model,color,type,price) values(3003,'true','laser',899); insert

25、 into Printer (model,color,type,price) values(3004,'true','ink-jet',120); insert into Printer (model,color,type,price) values(3005,'false','laser',120); insert into Printer (model,color,type,price) values(3006,'true','ink-jet',100); insert into Printer (model,color,type,price) values(3

26、007,'true','laser',200); insert into Laptop (model,speed,ram,hd,screen,price) values(2001,2.00,2048,240,20.1,3673); insert into Laptop (model,speed,ram,hd,screen,price) values(2002,1.73,1024,80,17.0,3673); insert into Laptop (model,speed,ram,hd,screen,price) values(2003,1.802,512,60,16.4

27、549); insert into Laptop (model,speed,ram,hd,screen,price) values(2004,2.00,512,60,13.3,1150); insert into Laptop (model,speed,ram,hd,screen,price) values(2005,2.16,1024,120,17.0,2600); insert into Laptop (model,speed,ram,hd,screen,price) values(2006,2.00,2048,80,15.4,1700); insert i

28、nto Laptop (model,speed,ram,hd,screen,price) values(2007,1.83,1024,120,13.3,1429); insert into Laptop (model,speed,ram,hd,screen,price) values(2008,1.60,1024,100,15.4,900); insert into Laptop (model,speed,ram,hd,screen,price) values(2009,1.60,512,80,14.1,680); insert into Laptop (model,s

29、peed,ram,hd,screen,price) values(2010,2.00,2048,160,15.4,2300); 数据库2:zuoye2 into Classes(class,type,country,numGuns,bore,displacement) values('Bismark','bb','Germany',8,15,42000); insert into Classes(class,type,country,numGuns,bore,displacement) values('Iowa','bb','USA',9,15,46000); inser

30、t into Classes(class,type,country,numGuns,bore,displacement) values('Kongo','bc','Janpan',8,14,32000); insert into Classes(class,type,country,numGuns,bore,displacement) values('North Carolina','bb','USA',9,16,37000); insert into Classes(class,type,country,numGuns,bore,displacement) values

31、'Renown','bc','Gt.Brintain',6,15,32000); insert into Classes(class,type,country,numGuns,bore,displacement) values('Revenge','bb','Gt.Brintain',8,15,29000); insert into Classes(class,type,country,numGuns,bore,displacement) values('Tennessee','bb','USA',12,14,32000); insert into Classes(cl

32、ass,type,country,numGuns,bore,displacement) values('Yamato','bb','Janpan',9,18,65000); insert into Battles(name,date) values('Denmark Strait','5/24-27-41'); insert into Battles(name,date) values('Guadalcanal','11/15/42'); insert into Battles(name,date) values('North Cape','12/26/43');

33、insert into Battles(name,date) values('Surigao Strait','10/25/44'); insert into Ships(name,class,launched) values('California','Tennessee',1921); insert into Ships(name,class,launched) values('Haruna','Kongo',1915); insert into Ships(name,class,launched) values('Hiei','Kongo',1914);

34、insert into Ships(name,class,launched) values('Iowa','Iowa',1943); insert into Ships(name,class,launched) values('Kirishima','Kongo',1915); insert into Ships(name,class,launched) values('Kongo','Kongo',1913); insert into Ships(name,class,launched) values('Missouri','Iowa',1944); inse

35、rt into Ships(name,class,launched) values('Mnsashi','Yamato',1942); insert into Ships(name,class,launched) values('New Jersey','Iowa',1943); insert into Ships(name,class,launched) values('North California','North California',1941); insert into Ships(name,class,launched) values('Ramill

36、iss','Revenge',1917); insert into Ships(name,class,launched) values('Renown','Renown',1915); insert into Ships(name,class,launched) values('Repulse','Renown',1915); insert into Ships(name,class,launched) values('Resolution','Revenge',1916); insert into Ships(name,class,launched) val

37、ues('Revenge','Revenge',1916); insert into Ships(name,class,launched) values('Royal Dak','Revenge',1916); insert into Ships(name,class,launched) values('Royal Sovereign','Revenge',1916); insert into Ships(name,class,launched) values('Tennessee','Tennessee',1920); insert into Ships(nam

38、e,class,launched) values('Washington','North Carolina',1941); insert into Ships(name,class,launched) values('Wisconsin','Iowa',1944); insert into Ships(name,class,launched) values('Yamato','Yamato',1941); insert into Outcomes(ship,battle,result) values('Arizona','Pearl Harbor','sunk');

39、 insert into Outcomes(ship,battle,result) values('Bismarck','Denmark Strait','sunk'); insert into Outcomes(ship,battle,result) values('California','Denmark Strait','ok'); insert into Outcomes(ship,battle,result) values('Dunk of York','North Cape','ok'); insert into Outcomes(ship,battle

40、result) values('Fuso','Surgao Strait','sunk'); insert into Outcomes(ship,battle,result) values('Hook','Denmark Strait','sunk'); insert into Outcomes(ship,battle,result) values('King George V','Denmark Strait','ok'); insert into Outcomes(ship,battle,result) values('Kirishina','Guadalcan

41、al','sunk'); insert into Outcomes(ship,battle,result) values('Prince of Wales','Denmark Strait','damaged'); insert into Outcomes(ship,battle,result) values('Rodney','Denmark Strait','ok'); insert into Outcomes(ship,battle,result) values('Scharnhorst','North Cape','sunk'); insert into

42、Outcomes(ship,battle,result) values('South Dakota','Guadalcanal','damaged'); insert into Outcomes(ship,battle,result) values('Tennessee','Surigao Strait','ok'); insert into Outcomes(ship,battle,result) values('Washington','Guadalcanal','ok'); insert into Outcomes(ship,battle,result) val

43、ues('West Virginia','Surigao Strait','ok'); insert into Outcomes(ship,battle,result) values('Yamashiro','Surigao Strait','sunk'); 4.基于习题5.2.4给出的数据库模式和数据写出后面的查询语句以及查询结果。 Classes ( class , type , country , numGuns , bore , displacement ) Ships( name , class , launched ) Battles( nam

44、e , date ) Outcomes ( ship , battle , result ) a)找出战舰类型的数量。 b)找出不同类型战舰拥有的平均火炮数量。 !c)找出战舰的平均火炮数量。注意c)和b)的不同在于:在计算均值的时候,是使用战舰的数目还是战舰的类型数目。 !d)找出每一类型( class )的第一艘船下水的年份。 !e)找出每一类型中被击沉船的数目。 !!f) 找出至少有3艘船的类型中被击沉的船的数目。 !!g)军舰火炮使用的炮弹的重量(以磅为单位)大约是火炮的口径(以英寸为单位)的一半。找出各个国家的军舰炮弹重量的平均值。 SQL语句:

45、a) select count (distinct class) from ships b) select type, avg(numGuns) from classes group by type having type in (select distinct type from classes) c) select type ,sum(numGuns) from classes group by type d) select class,min(launched) from ships group

46、 by class e) select class, count(result) from outcomes,ships where result='sunk' and ships.name=outcomes.ship group by class f) select country ,avg(bore*1/2) from classes group by country 5.根据习题5.2.1给出的数据库模式,写出下面的数据库修改。描述对该习题数据库修改够的结果。 Product(marker, model, t

47、ype) PC(model, speed, ram, hd, rd, price) Laptop(model, speed, ram ,hd, screen, price) Printer(model, color, type, price) a) 通过两条INSERT语句在数据库中添加如下信息:制造商C生产的型号为1100的PC,速度为1800,RAM为256,硬盘大小80,具有一个20x的DVD,售价为$2499。 !b) 加入如下信息:对于数据库中每台PC,都对应一台与其速度、RAM、硬盘相同,具有15英寸的屏幕

48、型号大于1100、价格高于$500的相同厂商制造的手提电脑。 c) 删除所有硬盘不超过20G的PC。 d) 删除所有不制造打印机的厂商生产的手提电脑。 e) 厂商A收购了厂商B,将所有B生产的产品改为由A生产。 f) 对于每台PC,把它的内存加倍并且增加20G的硬盘容量。(记住UPDATE语句中可以同时更改多个属性的值) !g) 把厂商B生产的手提电脑的屏幕尺寸增加一英寸并且价格下调$100。 SQL语句: a) insert into PC (model,speed,ram,hd,price) values(11

49、00,1800,256,80,2499); insert into Product (marker,model,type) values('C',1100,'pc'); b) create table handpc ( speed varchar(28), ram varchar(28), hd varchar(28), screen varchar(28) check(screen='15'), model v

50、archar(28)check(model>1001) primary key, price int check(price>500), rd varchar(28), marker varchar(28), ) insert into handpc(model,speed,ram,hd,rd,price,marker) select '1002','2.10','512','250','2212','995','A'union select '

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服