MYSQL第一次作業

2021-09-26 07:12:34 字數 3082 閱讀 4755

-- 建立資料庫

create database lianxi_db;

create table employees(

employeesname varchar(50),

gender char(2),

birthday datetime,

degree varchar(12),

graduateschool varchar(50),

graduatedate datetime,

specialty varchar(200),

telephone varchar(50),

skill varchar (2000),

salary smallint,

allowandce decimal(18,2)

);-- 第一題

create table professor(

professorid int primary key not null,

name varchar(50) not null -- 教授姓名

);-- 第二題

create table course(

courseid int not null primary key ,

name varchar(50) , -- 課程名字

credits int -- 學分

);-- 第三題

create table room(

roomid int not null primary key,

comments varchar(50) , -- 教室名稱

capacity int -- 教室可以容納的人數

);-- 第四題

create table class(

classid int not null primary key ,

courseid int not null , -- 外來鍵,來自於course表

professorid int not null, -- 外來鍵,來自於professor表

roomid int not null , -- 外來鍵,來自於room表

time varchar(50), -- 上課時間段

constraint fk_courseid foreign key(courseid) references course(courseid),

constraint fk_professorid foreign key(professorid) references professor(professorid),

constraint fk_roomid foreign key(roomid) references room(roomid)

);-- 第五題

create table student(

studentid int not null primary key,

name varchar(50)

);-- 第6題

create table exam(

examid int not null primary key,

courseid int not null, -- 外來鍵,來自於course表

professorid int not null, -- 外來鍵,來自於professor表

sustainedon datetime , -- 考試時間

comments varchar(255), -- 本次考試的說明

constraint fk_satar foreign key (courseid) references course(courseid),

constraint fk_satar1 foreign key (professorid) references professor(professorid) );

drop table exam;

-- 第七題

create table enrollment(

enrollmentid int not null primary key,

studentid int not null, -- 外來鍵,來自student

classid int not null , -- 外來鍵,來自class

enrolledon datetime , -- 學生參加班級的時間

grade int , -- 班級得分

constraint fk_ss foreign key(studentid) references student(studentid),

constraint fk_ss1 foreign key (classid) references class(classid)

);-- 第八題

create table studentexam(

studentid int not null primary key, -- 外來鍵,來自student表

examid int not null , -- 外來鍵,來自exam表

mark int not null , -- 課程考試分數

ifpassed datetime , -- 是否通過考試

comments varchar(255), -- 考試情況評價

-- constraint fk_www foreign key(studentid) references student(studentsid),

constraint fk_ww foreign key(examid) references exam(examid) );

drop table studentexam;

create database stu_db;

create table student(

stu_num int not null primary key auto_increment,

name varchar(100),

major varchar(100),

age numeric(3),

language numeric(5,2),

mathematics numeric(5,2),

english numeric(5,2)

);

第一次作業

1.用較低的成本,開發出滿足客戶需求的軟體,開發的軟體可靠性高,易於維護和移植 2.分為設計階段,開發階段和測試執行階段 1 設計階段 分析客戶需求,明確要解決哪些問題,實現哪些功能,以及確定基本方法 2 開發階段 a.概要設計 畫出流程圖,進行模組化劃分,建立模組的層次結構以及呼叫關係 b.詳細設...

第一次作業

1.4 非計算機專業 程式和軟體有何不同?答 程式是通過計算機語言寫出來的具有許多演算法的摸板,是實現軟體功能的底層推手 推手的意思可以理解為動力 所以,程式是軟體的內在因子,而軟體是乙個或多個程式通過編譯器編譯出來的成品。1.3 查詢資料,解釋什麼是圖靈測試?答 指測試者與被測試者 乙個人和一台機...

第一次作業

1.解釋什麼是圖靈測試?圖靈測試 又稱 圖靈判斷 是圖靈提出的乙個關於機械人的著名判斷原則。一種測試機器是不是具備人類智慧型的方法。如果說現在有一台電腦,其運算速度非常快 記億容量和邏揖單元的數目也超過了人腦,而且還為這台電腦編寫了許多智慧型化的程式,並提供了合適種類的大量資料,使這台電腦能夠做一些...