【SQL开源代码栏目提醒】:网学会员SQL开源代码为您提供373.sql参考,解决您在373.sql学习中工作中的难题,参考学习。
create table tb_Stud20
(
学生编号 int primary key,--设置主键
学生 varchar(20),
学生性别 char(2)
)
insert into tb_stud20 values(10090, '乐乐','女')
GO
create table tb_StudentScore20
(
--用foreign key 设置外键
学生编号 int FOREIGN KEY REFERENCES tb_Stud20(学生编号),
学生成绩 float,
备注 varchar(20)
)
GO
/*向tb_StudentScore20中插入的学生编号的字段的值,
必须是tb_Stu20数据表中的学生编号中的值*/
insert into
tb_StudentScore20
values(10090,'98','无')
GO
Select * from tb_StudentScore20