0.数据库启动:
SQL Sever Management Studio
配置工具:sql sever 配置管理器最后一个(启动第一个和第四个)
1.数据库创建
https://jingyan.baidu.com/article/cd4c2979f4d97e756e6e6026.html
2.数据库表的创建:
https://jingyan.baidu.com/article/915fc414e85d8051394b20c5.html
3.数据库数据类型:
https://zhidao.baidu.com/question/69046104.html?qbl=relate_question_3&word=SqL%20sever%202008%D6%D0%D7%D6%B7%FB%C0%E0%D0%CD%B5%C4%CA%FD%BE%DD
4.数据库表数据的插入:
https://jingyan.baidu.com/article/a3f121e4cf554efc9152bb4e.html
5.数据库中建立的表建立索引:
https://jingyan.baidu.com/article/4dc40848ba2ad6c8d946f1bb.html
6.提示引用了无效表:
外键的数据类型应该一致
7.defual user,
check(Sno in(1,2)),
8.建表:
CREATE TABLE Student
(Sno VARCHAR(10) PRIMARY KEY,
Sname VARCHAR(10) NOT NULL,
Ssex VARCHAR(2) CHECK(Ssex in('男','女')),
Sclass VARCHAR(10),
Stel VARCHAR(11) NOT NULL,
Sgroup VARCHAR(1) NOT NULL,
SPASSWORD VARCHAR(10) NOT NULL
);
-----------------------------------------------
CREATE TABLE Teacher(
Tno varchar(10) primary key,
Sname varchar(10) unique not null,
Tsex varchar(2) check(Tsex in('男','女')),
Tdept varchar(20) not null default '计算机科学与技术',
Tdegree varchar(8),
Ttitle varchar(10),
Tright Bit not null check(Tright=1 OR Tright=0),
Ttel varchar(11) not null,
Temail varchar(50),
Tgroup varchar(1) not null,
Tpassword varchar(10) not null
);
-------------------------------------------------------
CREATE TABLE 毕业设计题目信息表(
Hno char(4) not null primary key,
Hname char(50) not null,
Hstatus char(5) not null,
Hcontent char(200),
dircetion char(200),
Tno varchar(10) REFERENCES Teacher(Tno),
Sno varchar(10) REFERENCES Student(Sno),
);
SQL SEVER基础
最新推荐文章于 2024-07-08 18:40:31 发布