表结构
--学生表tblStudent(编号StuId、姓名StuName、年龄StuAge、性别StuSex)
--课程表tblCourse(课程编号CourseId、课程名称CourseName、教师编号TeaId)
--成绩表tblScore(学生编号StuId、课程编号CourseId、成绩Score)
--教师表tblTeacher(教师编号TeaId、姓名TeaName)
CREATE TABLE tblStudent ( StuId INT, StuName nvarchar(32), StuAge INT, StuSex nvarchar(8) ) CREATE TABLE tblCourse ( CourseId INT, CourseName nvarchar(32), TeaId INT ) CREATE TABLE tblScore ( StuId INT, CourseId INT, Score INT ) CREATE TABLE tblTeacher ( TeaId INT, TeaName nvarchar(16) ) insert into tblStudent select 1,N‘刘一‘,18,N‘男‘ union all select 2,N‘钱二‘,19,N‘女‘ union all select 3,N‘张三‘,17,N‘男‘ union all select 4,N‘李四‘,18,N‘女‘ union all select 5,N‘王五‘,17,N‘男‘ union all select 6,N‘赵六‘,19,N‘女‘ insert into tblTeacher select 1,N‘叶平‘ union all select 2,N‘贺高‘ union all select 3,N‘杨艳‘ union all select 4,N‘周磊‘ insert into tblCourse select 1,N‘语文‘,1 union all select 2,N‘数学‘,2 union all select 3,N‘英语‘,3 union all select 4,N‘物理‘,4 insert into tblScore select 1,1,56 union all select 1,2,78 union all select 1,3,67 union all select 1,4,58 union all select 2,1,79 union all select 2,2,81 union all select 2,3,92 union all select 2,4,68 union all select 3,1,91 union all select 3,2,47 union all select 3,3,88 union all select 3,4,56 union all select 4,2,88 union all select 4,3,90 union all select 4,4,93 union all select 5,1,46 union all select 5,3,78 union all select 5,4,53 union all select 6,1,35 union all select 6,2,68 union all select 6,4,71
https://blog.csdn.net/sujiacheng_123/article/details/53928474
原文地址:https://www.cnblogs.com/cnki/p/9251106.html
时间: 2024-10-10 20:47:20