当前位置:文档之家› 数据库创建数据库和数据表实验报告

数据库创建数据库和数据表实验报告

的方法。

二、实验环境
Windows7操作系统,SQL Server软件。

三、实验内容
在SQL Server中创建数据库的方法主要有两种:一是在SQL Server Management Studio窗口中使用可视化界面,通过方便的图形化向导创建,二是通过执行Transact-SQL语句创建。

应外码做CASCADE操作。

四、实验步骤
创建数据库
CREATE DATABASE teacher
创建数据表
sno char(10) not null primary key,
sex char(2) check(sex in('男','女')) not null,
canme varchar(8) not null ,
DOB datetime,
dept varchar(10),
telno char(11) not null,
)
create table COURSE(
con char(5) not null primary key,
cname varchar(10) not null,
Cpno char(5),
teacher varchar(8) not null,
credit smallint,
)
create table SC(
son char(10) not null primary key,
con char(5) not null primary key,
score decimal(6,2) check(score in(score<'100'||score>'0')), )
五、实验心得
在这次数据库实验中,我初步的了解到了SQL的一些基本的操作,例如查询分析器的界面用法,也明白了大写小写并不影响数据查询,也知道了如何去创建数据库和数据表。

虽然在实验中出现了bug,不过通过书本都找解决了。

相关主题