0% found this document useful (0 votes)
32 views2 pages

Perbaikan Table

The document defines several tables for a database including tables for properties for rent, clients, viewings, registrations, branches, staff, and private owners with columns and foreign key constraints defined.

Uploaded by

Iqbal Sihabudin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views2 pages

Perbaikan Table

The document defines several tables for a database including tables for properties for rent, clients, viewings, registrations, branches, staff, and private owners with columns and foreign key constraints defined.

Uploaded by

Iqbal Sihabudin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

CREATE TABLE PropertyForRent (

propertyNo CHAR(4) NOT NULL,


street VARCHAR(25) NOT NULL,
city VARCHAR(20) NOT NULL,
postcode CHAR(7) NOT NULL,
pType VARCHAR(18) NOT NULL,
rooms NUMBER(5),
rent SMALLINT,
ownerNo CHAR(4) NOT NULL,
staffNo CHAR(4),
branchNo CHAR(4) NOT NULL,
PRIMARY KEY (propertyNo),
FOREIGN KEY (ownerNo)
REFERENCES PrivateOwner (ownerNo),
FOREIGN KEY (staffNo)
REFERENCES Staff (staffNo),
FOREIGN KEY (branchNo)
REFERENCES Branch (branchNo)
);

CREATE TABLE CClient (


clientNo CHAR(4) NOT NULL,
fName VARCHAR(50) NOT NULL,
lName VARCHAR(50) NOT NULL,
telNo CHAR(14) NOT NULL,
prefType VARCHAR(18) NOT NULL,
maxRent NUMBER(5),
eMail VARCHAR(50) NOT NULL,
PRIMARY KEY (clientNo)
);

CREATE TABLE Viewing (


clientNo CHAR(4) NOT NULL,
propertyNo CHAR(4) NOT NULL,
viewDate VARCHAR(10),
vComment VARCHAR(20),
PRIMARY KEY (clientNo , propertyNo , viewDate),
FOREIGN KEY (clientNo)
REFERENCES CClient (clientNo),
FOREIGN KEY (propertyNo)
REFERENCES PropertyforRent (propertyNo)
);

CREATE TABLE Registration (


clientNo CHAR(4) NOT NULL,
branchNo CHAR(4),
staffNo CHAR(4) ,
dateJoined DATE NOT NULL,
PRIMARY KEY (clientNo),
FOREIGN KEY (clientNo)
REFERENCES CClient (clientNo),
FOREIGN KEY (branchNo)
REFERENCES Branch (branchNo),
FOREIGN KEY (staffNo)
REFERENCES Staff (staffNo)
);

CREATE TABLE Branch (


branchNo CHAR(4) NOT NULL,
street VARCHAR(25) NOT NULL,
city VARCHAR(20) NOT NULL,
postcode CHAR(7) NOT NULL,
PRIMARY KEY (branchNo)
);

CREATE TABLE Staff (


staffNo CHAR(4) NOT NULL,
fName VARCHAR(50) NOT NULL,
lName VARCHAR(50) NOT NULL,
sPosition VARCHAR(15) NOT NULL,
sex CHAR(1),
DOB DATE,
salary INT,
branchNo CHAR(4) NOT NULL,
PRIMARY KEY (staffNo),
FOREIGN KEY (branchNo)
REFERENCES Branch (branchNo)
);

CREATE TABLE PrivateOwner (


ownerNo CHAR(4) NOT NULL,
fName VARCHAR(50) NOT NULL,
lName VARCHAR(50) NOT NULL,
street VARCHAR(25) NOT NULL,
city VARCHAR(20) NOT NULL,
postcode CHAR(7) NOT NULL,
telNo CHAR(14) NOT NULL,
eMail VARCHAR(50) NOT NULL,
PRIMARY KEY (ownerNo)
);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy