MS SQL Server 使用Word文档下载推荐.docx
- 文档编号:7459644
- 上传时间:2023-05-08
- 格式:DOCX
- 页数:10
- 大小:638.86KB
MS SQL Server 使用Word文档下载推荐.docx
《MS SQL Server 使用Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《MS SQL Server 使用Word文档下载推荐.docx(10页珍藏版)》请在冰点文库上搜索。
4.注册SQLServer
SQLServerGroup→SQLServer
5.创建数据库
Database→newdatabase→
dbname(dbname_Data.MDF,dbname_Log.LDF)
Location:
c:
\Programfiles\MicrosoftSQLServer\MSSQL\DATA\…
6.创建基本表
Table→NEW→列名→类型→长度、NULL、Key
按照上述步骤,创建以下基本表:
Product(maker,model,type)
PC(model,speed,ram,hd,cd,price)
Laptop(model,speed,ram,hd,screen,price)
Printer(model,color,type,price)
7.输入数据
Tables→T1→opentable
给以下关系输入数据:
8.数据查询
使用SQL完成以下查询:
P2526.1.3
1.Findthemodelnumber,speed,andhard-disksizeforallPC’swhosepriceisunder$1600.
2.Dothesameas(a),butrenamethespeedcolumnmegahertzandthehdcolumngigabytes.
3.Findthemanufacturersofprinters.
4.Findthemodelnumber,memorysize,andscreensizeforlaptopscostingmorethan$2000.
5.FindallthetuplesinthePrinterrelationforcolorprinters.
6.Findthemodelnumber,speed,andhard-disksizeforthosePC’sthathaveeithera6xor8xCDandapricelessthan$2000.
P2626.2.2
1.Givethemanufacturerandspeedoflaptopswithaharddiskofatleastonegigabyte.
2.Findthemodelnumberandpriceofallproducts(ofanytype)madebymanufacturerB.
3.FindthosemanufacturersthatsellLaptops,butnotPC’s.
4.Findthosehard-disksizesthatoccurintwoormorePC’s.
5.FindthosepairsofPCmodelsthathaveboththesamespeedandRAM.
6.Findthosemanufacturersofatleasttwodifferentcomputers(PC’sorlaptops)withspeedsofatleast133.
另一个查询工具:
Database→Tools→SQLServerQueryAnalyzer→DB
9.数据库备份
BackupDatabase→
c:
\Programfiles\MicrosoftSQLServer\MSSQL\BACKUP
10.数据库恢复
RestoreDatabase→name
11.分离数据库
12.附加数据库→c:
\Programfiles\MicrosoftSQLServer\MSSQL\data\dbname_Data.MDF
13.数据的导入/导出
课外上机:
1.为你的数据库应用课题建立数据库,建立各关系,并输入数据
2.设计关于该数据库的各类查询问题,并完成查询
3.分离数据库
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- MS SQL Server 使用