27,580
社区成员
发帖
与我相关
我的任务
分享
CREATE TABLE [Student] (
[ID] [bigint] IDENTITY (1, 1) NOT NULL ,
[Name] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
CONSTRAINT [PK_Student] PRIMARY KEY CLUSTERED
(
[ID]
) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [Score] (
[ID] [bigint] IDENTITY (1, 1) NOT NULL ,
[Score] [int] NULL ,
[Subject] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[StudentID] [bigint] NULL ,
CONSTRAINT [PK_Score] PRIMARY KEY CLUSTERED
(
[ID]
) ON [PRIMARY]
) ON [PRIMARY]
GO
Create View StuScore
as
Select Student.Name,Score.Score,Score.Subject from Score,Student
where
Score.StudentID=Student.id
Create trigger InsTriStuScore on StuScore Instead of Insert
as
begin
Insert into Student (Name) Values ('kkk')
end;
Create trigger UpdTriStuScore on StuScore Instead of Update
as
begin
Insert into Student (Name) Values ('kkk')
end;
Insert into Student (Name) Values ('张三')
Insert into Student (Name) Values ('李四')
Insert into Student (StudentID,Subject,Score) Values (1,'英语',10)
Insert into Student (StudentID,Subject,Score) Values (1,'历史',20)
Insert into Student (StudentID,Subject,Score) Values (2,'英语',11)
Insert into Student (StudentID,Subject,Score) Values (2,'历史',22)