- 1、本文档共10页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
sqlserver数据库操作语句-基础部分(SQLSERVER database manipulation statement - basic part)
sqlserver数据库操作语句-基础部分(SQLSERVER database manipulation statement - basic part)
The first part: basic knowledge of database / * * / review exercise
--1. creates the database
If exists (select * from, sysdatabases, where, name=proj)
Drop database proj
Go
Create database proj
--2. deletes the database
Drop database proj
--3. backup SQL Server
- create device for backup data
Use master
Exec, sp_addumpdevice,disk,testBack,d:\mssqlbackup\MyNwind_1.dat
- start backup
Backup, database, proj, to, testBack
--4. creates new tables
Use proj
Create table tbpro
(
Id int primary key,
Name varchar (50) not null
)
Create table tbobj
(
CID int primary key,
Object varchar (50) not null
)
- create new tables based on existing tables
Select*into tbpro1 from tbpro
- use the following creation methods in the Oracle Database
Create, table, tbpro1, like, tbpro
Create, table, tbpro2, as, select, name, from, tbpro, only, definition
--5. deletes new tables
Drop table tbpro
Drop table tbobj
--6. adds a column [Note: columns added will not be deleted. The DB2 column after the data type does not change, the only change is to increase the size of the varchar. ]
Alter, table, tbpro, add, age, int
Alter, table, tbobj, add, area, varchar (100)
--7. add primary key / delete primary key
Alter, table, tbpro, add, primary, key (ID)
Alter, table, tbpro, drop, primary, key (ID)
--8. create index
Create, unique, index, ind, on, tbpro (name)
- delete the index. [Note: the index is not modifiable. If you want to change it, you must delete it. ]
Drop, index, ind, on, tbpro
--9. create views
Create, view, viewpro, as, select, name, from, tbpro
--10. delete view
Drop view viewpro
--11. several simple basic SQL statements
-- Choice
Select *from tbpro
-- insert
Insert, into, tbpro, values (1,tom, 23)
Insert, into, tbpro, values (2,jim, 34)
Insert, into, tbpro, values (3,lucy, 19)
Insert, into, tbpro, values (4,lily, 21)
Insert, into, tbobj, values (0001,chinese,shandong)
-- delete
Delete, from, tbpro, where, id=4
-
您可能关注的文档
- bat 批处理延迟运行脚本(Bat batch running script).doc
- bh1750数字光照(Bh1750 digital light).doc
- beautiful smile and love美丽的微笑和爱心(美丽的微笑与爱心美丽的微笑和爱心).doc
- boys love 名言(男生的爱名言).doc
- bilibili入站测试(bilibili入站测试).doc
- bedzed(BedZED).doc
- bt3破解无线wep_wpa2(BT3 crack wireless wep_wpa2).doc
- bt下载狂热者分析各种破解方法(BT download enthusiasts analyze various crack methods).doc
- build.prop优化(build.prop优化).doc
- bp神经网络c语言实现(BP neural network, C language implementation).doc
文档评论(0)