Problem 1.	One-To-One Relationship

Problem 1. One-To-One Relationship

LVVeselinov avatar LVVeselinov 0 Точки

Problem 1. One-To-One Relationship

Здравейте колеги,

Judge ми дава 66/100

Може ли да ми кажете какво пропускам

CREATE TABLE Persons

(

PersonalId INT NOT NULL,

FirstName NVARCHAR(25),

Salary DECIMAL(8,2),

PasspordID INT UNIQUE

)

 

CREATE TABLE Passports

(

PassportID INT NOT NULL UNIQUE,

PassportNumber NVARCHAR(25)

)

INSERT INTO Persons (PersonalId,FirstName,Salary,PasspordID)

VALUES(1,'Roberto',43300.00,102),(2,'Tom',56100.00,103),(3,'Yana',60200.00,101)

 

INSERT INTO Passports(PassportID, PassportNumber)

VALUES (101,'N34FG21B'),(102,'K65LO4R7'),(103,'ZE657QP2')

 

 

ALTER TABLE Persons

ADD CONSTRAINT pk_PersonID PRIMARY KEY (PersonalID)

ALTER TABLE Passports

ADD CONSTRAINT pk_PassportsID PRIMARY KEY ([PassportID])

 

ALTER TABLE Persons

ADD CONSTRAINT fk_Pesrons_Passports FOREIGN KEY([PasspordID])

REFERENCES Passports([PassportID])

Тагове:
0
Databases Basics
Wencii avatar Wencii 88 Точки

На места си писал passporD, на места passporT. Като го оправиш дава 100/100.

0
04/02/2017 12:04:39
LVVeselinov avatar LVVeselinov 0 Точки

Мерси :)

0