Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table Pilot
- (
- IdPilot int not null Constraint PrimaryPilot Primary Key,
- Surname varchar(30) not null,
- age int not null,
- IdRank int not null constraint ForeignPilotRank Foreign Key
- references Rank(IdRank),
- IdCompet int not null Constraint ForeignCompetPilot Foreign Key
- references Competition(IdCompetition),
- IdResults int not null Constraint ForeignResultsPilot foreign key
- references Results(IdResults)
- )
- alter table Pilot
- add IdCar int not null Constraint ForeignCarPilot Foreign Key
- references Car(IdCar)
- create table Rank
- (
- IdRank int not null constraint PrimaryRank Primary Key,
- RankName varchar(4) not null
- )
- create table Results
- (
- IdResults int not null constraint PrimaryResults Primary Key,
- NameResult varchar(5) not null,
- IdRank int not null constraint ForeignRank Foreign Key
- references Rank(IdRank)
- )
- create table Judge
- (
- IdJudge int not null constraint PrimaryFudge Primary Key,
- Surname varchar(30) not null,
- Experience int not null
- )
- create table Type
- (
- IdType int not null constraint PrimaryType Primary Key,
- Name varchar(30) not null,
- IdJudge int not null Constraint ForeignJudge Foreign Key
- references Judge(IdJudge)
- )
- create table Competition
- (
- IdCompetition int not null Constraint PrimaryCom Primary Key,
- Date DateTime not null,
- IdType int not null constraint ForeignComType Foreign Key
- references Type(IdType),
- IdResult int not null constraint ForeignResultsCom foreign key
- references Results(IdResults)
- )
- create table Car
- (
- IdCar int not null Constraint PrimaryCar primary key,
- Make varchar(20),
- Power int not null,
- IdPilot int not null constraint ForeignPilotCar Foreign Key
- references Pilot(IdPilot),
- IdRank int not null constraint ForeignRankPilot Foreign Key
- references Rank(IdRank)
- )
- create table Track
- (
- IdTrack int not null Constraint PrimaryTrack Primary Key,
- Name varchar(30) not null,
- Length int not null,
- IdJudge int not null constraint ForeignTrackJudge Foreign Key
- references Judge(IdJudge)
- )
- --1
- alter table Competition
- add lasting int
- --2
- alter table Pilot
- alter column Surname varchar(25)
- --3
- Alter table Judge
- add constraint UniqueSur Unique (Surname)
- --4
- alter table Car
- add Speed varchar(50)
- /*alter table car
- add Constraint SpeedLen Check (Len(speed=<30))*/
- --5
- alter table Track
- add Constraint TrackOdd check(Length%2>=100 and Length%2<=10000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement