Home > database >  Database problems, big help
Database problems, big help

Time:10-08

The create table sc
(
ScNO char (5),
SNO char (5),
CNO char (5),
MARK numeric (4, 2)
)
The alter table sc alter column scNO char (5) the not null
The alter table sc add constraint PK_sc primary key (scNO)
The alter table sc add check (scNO like '[0-9] [0-9] [0-9] [0-9] [0-9]')
The alter table sc alter column SNO char (5) the not null
The alter table sc alter column CNO char (5) the not null
The alter table sc add foreign key references (SNO) student (SNO)
The alter table sc add constraint FK_COUNO foreign key references (CNO) course (CNO)
The alter table sc add check (MARK>=0 AND MARK<=100)

CodePudding user response:

The foreign key in the student table should be can't find the corresponding SNO

CodePudding user response:

Understand the foreign keys,,
  • Related