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.
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 ratings0% 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.
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) );
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) );