-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTables.sql
More file actions
62 lines (58 loc) · 1.29 KB
/
Tables.sql
File metadata and controls
62 lines (58 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
create table Property_User
(
adhaarID NUMBER(12) ,
name VARCHAR(30),
age INT,
manager NUMBER(1),
PRIMARY KEY(adhaarID)
);
create table Phone_number
(
adhaarId NUMBER(12),
Phone_Number NUMBER(10) ,
FOREIGN KEY (adhaarID) REFERENCES Property_User(adhaarID) ,
CONSTRAINT number_unique UNIQUE (Phone_Number)
);
create table User_Address
(
adhaarID NUMBER(12),
Door_No NUMBER(3),
Street VARCHAR(20),
City VARCHAR(20),
State VARCHAR(20),
PINCODE NUMBER(6),
PRIMARY KEY(adhaarID),
FOREIGN KEY (adhaarID) REFERENCES Property_User(adhaarID)
);
create table Property
(
PropertyID NUMBER(20) PRIMARY KEY,
OwnerAdhaarID NUMBER(12),
AvailableFrom DATE,
AvailableTill DATE,
RentPerMonth INT,
AnnualHike INT,
TotalArea INT,
PlintArea INT,
BedRooms INT,
Floors INT,
YearOfConstruction INT,
Locality VARCHAR(40),
Address VARCHAR(40),
OtherFacilities VARCHAR(40),
Type CHAR(1),
FOREIGN KEY (OwnerAdhaarID) REFERENCES Property_User(adhaarID)
);
create table Rented
(
PropertyID,
TenantID NUMBER(12),
RentPerMonth INT,
Start_Date DATE,
End_Date DATE,
YearlyHike INT,
AgencyCommission INT,
Current_Resident INT,
FOREIGN KEY (PropertyID) REFERENCES Property(PropertyID),
FOREIGN KEY (TenantID) REFERENCES Property_User(adhaarID)
);