34,838
社区成员




create table teacher
(
tid varchar(12) not null,
tname varchar(20) not null,
constraint PK_TEACHER primary key (tid)
)
go
create table student
(
xh varchar(20) not null,
tid varchar(12) null ,
sname varchar(20) not null,
constraint PK_STUDENT primary key (xh)
)
go
create index Relation_11_FK on student (tid)
go
alter table student
add constraint FK_STUDENT_RELATION__TEACHER foreign key (tid)
references teacher (tid)
go
select teacher.* , student.* from teacher left join student on teacher.tid = student.tid where teacher.tid = '001'
select teacher.* , student.* from teacher left join student on teacher.tid = student.tid where teacher.tid = '001'
select teacher.* , student.* from teacher left join student on teacher.tid = student.tid
where teacher.tid = '001'