第一次建立数据库,有很多问题,求指教
use movie
create table actors
(
AID numeric(4,0) primary key,
name varchar(8),
);
create table movies
(
MID numeric(4,0) primary key,
title varchar(15),
);
create table actor_role
(
MID numeric(4,0),
AID numeric(4,0),
rolename varchar(15),
foreign key (MID) references movies,
foreign key (AID) references actors,
primary key (MID,AID),
); //这是表格的建立
use movie
insert into movies values (0001,'breaveheart');
insert into movies values (0002,'whitehouse');
insert into movies values (0003,'batman');
insert into movies values (0004,'spiderman');
insert into movies values (0005,'superman');
insert into actors values (1111,'brucelee');
insert into actors values (2222,'frank');
insert into actors values (3333,'jimmy');
insert into actors values (4444,'sky');
insert into actors values (5555,'enda');
insert into actor_role values (0001,3333,'shaw');
insert into actor_role values (0001,5555,'wayen');
insert into actor_role values (0002,2222,'cale');
insert into actor_role values (0002,1111,'lee');
insert into actor_role values (0003,5555,'park');
insert into actor_role values (0004,1111,'paul');
insert into actor_role values (0005,2222,'bayen');
//这是数据的录入
但是出现了很多错误:
Violation of PRIMARY KEY constraint 'PK__movies__C797348A03317E3D'. Cannot insert duplicate key in object 'dbo.movies'.
The statement has been terminated.
Msg 2627, Level 14, State 1, Line 4
Violation of PRIMARY KEY constraint 'PK__movies__C797348A03317E3D'. Cannot insert duplicate key in object 'dbo.movies'.
The statement has been terminated.
Msg 2627, Level 14, State 1, Line 5
Violation of PRIMARY KEY constraint 'PK__movies__C797348A03317E3D'. Cannot insert duplicate key in object 'dbo.movies'.
The statement has been terminated.
Msg 2627, Level 14, State 1, Line 6
Violation of PRIMARY KEY constraint 'PK__movies__C797348A03317E3D'. Cannot insert duplicate key in object 'dbo.movies'.
The statement has been terminated.
Msg 2627, Level 14, State 1, Line 7
Violation of PRIMARY KEY constraint 'PK__movies__C797348A03317E3D'. Cannot insert duplicate key in object 'dbo.movies'.
The statement has been terminated.
Msg 2627, Level 14, State 1, Line 9
Violation of PRIMARY KEY constraint 'PK__actors__C69007C87F60ED59'. Cannot insert duplicate key in object 'dbo.actors'.
The statement has been terminated