Jeg er ikke sikker på om den virker, men du kan forsøge.
- DROP TABLE Persons CASCADE CONSTRAINT;
- CREATE TABLE Persons
- (
- Id int NOT NULL PRIMARY KEY,
- Pnr int NOT NULL,
- Fname varchar(15) NOT NULL,
- Lname varchar(15) NOT NULL,
- Adr varchar(30) NOT NULL,
- Zip int NOT NULL,
- FOREIGN KEY (Zip) REFERENCES Zip(Zip),
- FOREIGN KEY (Pnr) REFERENCES Phone(Pnr)
- );
-
- DROP TABLE Zip CASCADE CONSTRAINT;
- CREATE TABLE Zip
- (
- Zip int NOT NULL PRIMARY KEY,
- City varchar(15) NOT NULL
- );
-
- DROP TABLE Phone CASCADE CONSTRAINT;
- CREATE TABLE Phone
- (
- Pnr int NOT NULL PRIMARY KEY,
- Htlf int NULL,
- Mtlf int NULL
- );