73765 - SQL task/database.sql
Create table Building(
Building_ID int primary key,
Building_Name varchar(50),
Building_Address varchar(50),
Built_Year int,
Building_Capacity int
);
Create table Owner(
Owner_ID int primary key,
Owner_Fname varchar(50),
Owner_Lname varchar(50),
Owner_Email varchar(100),
Owner_Phone varchar(10)
);
Create table Apartment(
Apartment_ID int primary key,
Total_Rooms int,
Apartment_Rent decimal,
Building_ID int,
Owner_ID int,
foreign key(Building_ID) references Building(Building_ID),
foreign key(Owner_ID) references Owner(Owner_ID)
);
Insert into Building (Building_ID, Building_Name, Building_Address, Built_Year, Building_Capacity)
values (1001,'Lilly Pilly','Wakefield Street',1995, 5000),
(1002,'Early Settler','Flinders Street',2006,2000),
(1003,'Horizon East','Maldives Street',2018,5000),
(1004,'Ocean Blue','Wakefield Street',2020,15000),
(1005,'Early Set','Maldives Street',2001,6000);
Insert into Owner(Owner_ID, Owner_Fname,Owner_Lname,Owner_Email,Owner_Phone)
values (2001,'Hazel','Alex','
[email protected]','04023466'),
(2002,'Saber','Khan','
[email protected]','04034566'),
(2003,'Adam','Smith','
[email protected]','04345567'),
(2004,'Lisa','Owen','
[email protected]','04078066'),
(2005,'Steven','Smith','
[email protected]','04078077'),
(2006,'James','Steve','
[email protected]','45657755');
Insert into Apartment(Apartment_ID,Apartment_Rent,Total_Rooms,Building_ID,Owner_ID)
values(1001,500,2,1001,2001),
(1002,600,3,1001,2002),
(1003,1000,2,1001,2004),
(1004,389,1,1003,2003),
(1005,400,1,1004,2001),
(1006,590,2,1001,2002),
(1007,345,2,1003,2004),
(1008,789,3,1004,2001),
(1009,500,5,1005,2004),
(1010,599,5,1005,2005);
73765 - SQL task/output-3pddzaaj.rtf
Task 1
Create table Building(
Building_ID int primary key,
Building_Name varchar(50),
Building_Address varchar(50),
Built_Year int,
Building_Capacity int
);
Create table Owner(
Owner_ID int primary key,
Owner_Fname varchar(50),
Owner_Lname varchar(50),
Owner_Email varchar(100),
Owner_Phone varchar(10)
);
Create table Apartment(
Apartment_ID int primary key,
Total_Rooms int,
Apartment_Rent decimal,
Building_ID int,
Owner_ID int,
foreign key(Building_ID) references Building(Building_ID),
foreign key(Owner_ID) references Owner(Owner_ID)
);
Task 2
Insert into Building (Building_ID, Building_Name, Building_Address, Built_Year, Building_Capacity)
values (1001,'Lilly Pilly','Wakefield Street',1995, 5000),
(1002,'Early Settler','Flinders Street',2006,2000),
(1003,'Horizon East','Maldives...