CREATE DATABASE LabTask
CREATE DATABASE LabTask
);
);
);
);
);
);
Or
CREATE TABLE Viewing
(
clientNo varchar(10),
propertyNo varchar(4),
viewDate varchar(10),
comment varchar(20),
constraint PK_viewing primary key (clientNo, propertyNo, viewDate),
constraint FK_ClientViewing foreign key (clientNo) references Client(clientNo),
constraint FK_PropertyForRentViewing foreign key (propertyNo) references
PropertyForRent(propertyNo)
);
CREATE TABLE Registration
(
clientNo varchar(10),
branchNo varchar(4),
staffNo varchar(4),
dateJoined varchar(20),
constraint PK_Registration primary key (clientNo, branchNo),
constraint FK_clientRegistration foreign key (clientNo) references client(clientNo),
constraint FK_branchRegistration foreign key (branchNo) references Branch(branchNo),
);
3RD TABLE
INSERT into
PropertyForRent(propertyNo,street,city,postcode,_type,rooms,rent,ownerNo,staffNo,branchNo
)
values('PA14','16 Holhead','Aberdeen', 'AB7 5SU', 'House',6,650,'CO46','SA9','B007');
INSERT into
PropertyForRent(propertyNo,street,city,postcode,_type,rooms,rent,ownerNo,staffNo,branchNo
)
values('PL94','6 Argyll St','London', 'NW2', 'Flat',4,400,'CO87','SL41','B005');
INSERT into
PropertyForRent(propertyNo,street,city,postcode,_type,rooms,rent,ownerNo,branchNo)
values('PG4','6 Lawrence St','Glasgow', 'G11 9QX', 'Flat',3,350,'CO40','B003');
INSERT into
PropertyForRent(propertyNo,street,city,postcode,_type,rooms,rent,ownerNo,staffNo,branchNo
)
values('PG36','2 Manor Rd','Glasgow', 'G32 4QX', 'Flat',3,375,'CO93','SG37','B003');
INSERT into
PropertyForRent(propertyNo,street,city,postcode,_type,rooms,rent,ownerNo,staffNo,branchNo
)
values('PG21','18 Dale Rd','Glasgow', 'G12', 'House',5,600,'CO87','SG37','B003');
INSERT into
PropertyForRent(propertyNo,street,city,postcode,_type,rooms,rent,ownerNo,staffNo,branchNo
)
values('PG16','5 Novar Dr','Glasgow', 'G12 9AX', 'Flat',4,450,'CO93','SG14','B003');
4th table
INSERT INTO Client(clientNo,fName,lName,telNo,prefType,maxRent)
values('CR76','John','Kay','0207-774-5632','Flat',425);
5th table
insert into PrivateOwner(ownerNo,fName,lName,_address,telNo)
values('CO46','Joe','Keogh','2 Fergus Dr,Aberdeen AB2 7SX','01224-861212');
6th table
7th table
INSERT into Registration(clientNo,branchNo,staffNo,dateJoined)
VALUES ('CR76','B005','SL41','2-Jan-04');