摘要: --触发器:触发器就是一种特殊的存储过程,只用来“增删改”--触发器特殊的地方就在于,触发器是通过对数据库表的操作,来引发--存储过程是通过人为exec来执行select *from Studentcreate trigger Student_Insert --创建触发器on Student --指... 阅读全文
posted @ 2015-04-29 11:25 Yusarin 阅读(911) 评论(0) 推荐(0) 编辑
摘要: --备份:在不影响数据库正常运行情况下,将数据备份到一个.bak结尾的文件--还原:将.bak文件还原到数据库--分离:将数据库与数据库服务进行分离--附加:将数据库.mdf文件,附加到数据库服务上 阅读全文
posted @ 2015-04-28 10:00 Yusarin 阅读(301) 评论(0) 推荐(0) 编辑
摘要: --约束:对列的数据值起一个约束的作用,规定列的值的范围--主键,外键,非空,自增长,唯一列unique(name,value),check约束 阅读全文
posted @ 2015-04-28 09:56 Yusarin 阅读(261) 评论(0) 推荐(0) 编辑
摘要: --视图,视图就是一个虚拟的表,只能查询,不能修改!只能用作查询!select *from View_1 --显示101这个学生的学生sno,sname,cno,degreecreate view view 2as select Student.Sno,sname,cno,DEGREE from... 阅读全文
posted @ 2015-04-28 09:38 Yusarin 阅读(625) 评论(0) 推荐(0) 编辑
摘要: --至查询student表的第3、4行--分页查询 ★必须要用主键Sno来排除,防止重复select *from Studentselect top 2 *from Student where Sno not in(select top 2 Sno from Student)--第二页,屏蔽掉当前页... 阅读全文
posted @ 2015-04-27 16:51 Yusarin 阅读(257) 评论(0) 推荐(0) 编辑
摘要: create table 仓库表( 仓库号 varchar(50) primary key not null, 城市 varchar(50) not null, 面积 int not null,)insert into 仓库表 values ('wh1','北京',370)insert into... 阅读全文
posted @ 2015-04-27 10:43 Yusarin 阅读(1257) 评论(0) 推荐(0) 编辑
摘要: create proc 存储过程名--输入参数;当调用存储过程时,所需要输入的数据--输出参数,从存储过程中赋值后带出数据as --存储过程内容 return 返回值goexce 返回值=存储过程名称 参数一,参数二,..,参数N--存储过程:相当于C#的函数--定义变量declare ... 阅读全文
posted @ 2015-04-27 10:42 Yusarin 阅读(290) 评论(0) 推荐(0) 编辑
摘要: create database 进出货存储过程gouse 进出货存储过程go--水果表create table Fruit( Ids varchar(50) primary key, [Name] varchar(50) not null, Price decimal(8,2), ... 阅读全文
posted @ 2015-04-27 10:41 Yusarin 阅读(415) 评论(0) 推荐(0) 编辑
摘要: 数据库只是一个工具 简写:SSMS 全拼:SQL Server Management Studio服务器名称: 数据库服务所在的电脑的ip地址 通过".(本台)","lacal(本地)"登陆点击电脑开始→ 运行→ cmd→ net start mssqlserver 服务器的启动 net... 阅读全文
posted @ 2015-04-25 20:48 Yusarin 阅读(245) 评论(0) 推荐(0) 编辑
摘要: create table Student--3rd再次执行( Sno int primary key not null,--学号主键 Sname varchar(50) not null,--学生姓名 Ssex varchar(50) not null,--学生性别 Sbirthda... 阅读全文
posted @ 2015-04-25 20:48 Yusarin 阅读(9537) 评论(0) 推荐(1) 编辑