there is a database comprising four tables: Student table (Student), Course table (Course), score table (score) and teacher Information sheet (Teacher). The structure of the four tables is shown in table 1-1 table (a ~ table (four), as shown in table 1-2 table (i) ~ table (iv). Create four tables with SQL statements and complete related topics.
Create DATABASE Ceshi
Go
Use Ceshi
Go
CREATE TABLE Student
(
Snochar (3) primary key,
Sname Char (8),
Ssex Char (2),
sbirthday datetime,
Class Char (5)
)
Go
CREATE TABLE Course
(
Cnochar (5) primary key,
Cname Varchar (Ten),
Tnochar (3)
)
Go
CREATE TABLE Score
(
Snochar (3),
Cnochar (5),
degree Decimal (4,1)
)
Go
CREATE TABLE Teacher
(
Tnochar (3) primary key,
tname Char (4),
tsex Char (2),
tbirthday datetime,
Prof Char (6),
depart Varchar (Ten)
)
Go
INSERT into Student values (108, ' Zeng Hua ', ' Male ', ' 1977-09-01 ', ' 95033 ')
INSERT INTO Student values (105, ' Kuanming ', ' Male ', ' 1975-10-02 ', ' 95031 ')
INSERT into Student values (107, ' Wang Li ', ' female ', ' 1976-01-23 ', ' 95033 ')
INSERT into Student values (101, ' Li June ', ' male ', ' 1976-02-20 ', ' 95033 ')
INSERT into Student values (109, ' Wang Fang ', ' female ', ' 1975-02-10 ', ' 95031 ')
INSERT INTO Student values (103, ' contacts ', ' Male ', ' 1974-06-03 ', ' 95031 ')
Go
INSERT into Course values (' 3-105 ', ' Introduction to Computers ', 825)
INSERT into Course values (' 3-245 ', ' operating system ', 804)
INSERT into Course values (' 6-166 ', ' digital circuit ', 856)
INSERT into Course values (' 9-888 ', ' Advanced math ', 831)
Go
INSERT INTO score values (103, ' 3-245 ',.)
INSERT INTO score values ("3-245,")
INSERT into score values (109, ' 3-245 ',.)
INSERT INTO score values (103, ' 3-105 ', ()
INSERT INTO score values ("3-105", +)
INSERT into score values (109, ' 3-105 ',.)
INSERT INTO score values (101, ' 3-105 ', +)
INSERT INTO score values (107, ' 3-105 ', in a few)
INSERT INTO score values (108, ' 3-105 ', +)
INSERT INTO score values (101, ' 6-166 ',.)
INSERT INTO score values (107, ' 6-166 ', +)
INSERT INTO score values (108, ' 6-166 ', Bayi)
Go
INSERT into Teacher values (804, ' sung ', ' Male ', ' 1985-12-02 ', ' associate Professor ', ' Computer Department ')
INSERT into Teacher values (856, ' Zhang Xu ', ' Male ', ' 1969-03-12 ', ' lecturer ', ' Electronic Engineering Department ')
INSERT into Teacher values (825, ' Wang Ping ', ' female ', ' 1972-05-05 ', ' ta ', ' Computer Department ')
INSERT into Teacher values (831, ' Liu Bing ', ' female ', ' 1977-08-14 ', ' ta ', ' Electronic Engineering Department ')
Go
SQL Server Statement test