0% found this document useful (0 votes)
44 views7 pages

Database 01

The document outlines an E-R diagram and data dictionaries for a property management system, detailing entities such as Property, PropertyOwner, Client, and Lease. It includes assumptions about property ownership, leasing, and staff management, as well as the structure and data types for each entity. Additionally, it provides SQL commands for creating corresponding tables in a physical schema.

Uploaded by

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

Database 01

The document outlines an E-R diagram and data dictionaries for a property management system, detailing entities such as Property, PropertyOwner, Client, and Lease. It includes assumptions about property ownership, leasing, and staff management, as well as the structure and data types for each entity. Additionally, it provides SQL commands for creating corresponding tables in a physical schema.

Uploaded by

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

a) E-R Diagram:

Assumptions:

1. Each property can have only one owner.


2. Each property can have multiple leases over time with different
clients.
3. A member of staff can manage multiple properties.
4. A client can rent multiple properties over time.

Note: The E-R Diagram is a visual representation of the scenario


described. Due to the limitations of text-based communication, I am
unable to provide a visual diagram in this format. I recommend using a
diagramming tool or software to create the E-R Diagram based on the
information provided

b)

c) Data Dictionaries

1. Property:

 PropertyNumber: Unique identifier for each property.


 AddressStreet: Street address of the property.
 AddressCity: City of the property.
 AddressPostcode: Postal code of the property.
 Type: Type of property.
 NumberOfRooms: Number of rooms in the property.
 MonthlyRent: Monthly rent amount.
 PropertyOwnerNumber: Foreign key referencing the
PropertyOwner entity.
fieldname Data type Data description example
format
proNumber integer NNNNN Unique 12345
identifier
for each
property.
addressStreet Var Street
character address of
the
property.
AddressCity Varcharacte City of the
r property
Type var Type of
character property.
numberOfrooms integer NNN Number of 678
rooms in
the
property
monthlyRent decimal (n,c) Monthly (10,2)
rent
amount
PropertyOwnerNumber integer NNNNN Foreign 96859
key
referencing
the
Property
Owner
entity.

AddressPostcode varcharacter NN Postal (10)


code of the
property
1. PropertyOwner:

 PropertyOwnerNumber: Unique identifier for each property


owner.
 Name: Name of the property owner.
 Address: Address of the property owner.
 TelephoneNumber: Email address of the property owner.
 Email: Email address of the property owner.
 Password: Password for accessing the DreamHome database.

fieldname Data type Data description example


format
PropertyOwnerNumber integer NNN Unique 897
identifier for
each
property
owner.

Name varcharacter Name of


the property
owner
Address varcharacter Address of
the property
owner
TelephoneNumber varcharater Email
address of
the property
owner
Email varchacter Email
address of
the property
owner
Password varchacter **** Password 8k0H
for
accessing
the
DreamHome
database
1. Client:

 ClientNumber: Unique identifier for each client.


 Name: Name of the client.
 TelephoneNumber: Telephone number of the client.
 Email: Email address of the client.
 PreferredAccommodationType: Preferred type of accommodation
for the client.
 MaxRent: Maximum rent amount the client is willing to pay.
 StaffMemberName

Fieldname Data Data descriptio example


type format n
ClientNumber integer Unique
identifier
for each
client
Name varchara Name of
cter the client
TelephoneNumber varchara Telephon
cter e number
of the
client
Email varchara Email
cter address of
the client
PreferredAccommodationTyp archarac Preferred
e ter type of
accommo
dation for
the client.

MaxRent decimal Maximum


rent
amount
the client
is willing
to pay
StaffMemberName varchara Name of
cter the person
from a
staff

d) Create the corresponding Physical schema for the logical


schema in

Creating the tables


CREATE TABLE Property (
PropertyNumber INT PRIMARY KEY,
AddressStreet VARCHAR(255),
AddressCity VARCHAR(255),
AddressPostcode VARCHAR(10),
Type VARCHAR(255),
NumberOfRooms INT,
MonthlyRent DECIMAL(10, 2),
PropertyOwnerNumber INT
);

CREATE TABLE PropertyOwner (


PropertyOwnerNumber INT PRIMARY KEY,
Name VARCHAR(255),
Address VARCHAR(255),
TelephoneNumber VARCHAR(20),
Email VARCHAR(255),
Password VARCHAR(255)
);

CREATE TABLE BusinessOwner (


PropertyOwnerNumber INT PRIMARY KEY,
BusinessName VARCHAR(255),
BusinessType VARCHAR(255),
ContactName VARCHAR(255),
FOREIGN KEY (PropertyOwnerNumber) REFERENCES
PropertyOwner(PropertyOwnerNumber)
);

CREATE TABLE PrivateOwner (


PropertyOwnerNumber INT PRIMARY KEY,
Name VARCHAR(255),
Address VARCHAR(255),
TelephoneNumber VARCHAR(20),
Email VARCHAR(255),
Password VARCHAR(255),
FOREIGN KEY (PropertyOwnerNumber) REFERENCES
PropertyOwner(PropertyOwnerNumber)
);

CREATE TABLE Client (


ClientNumber INT PRIMARY KEY,
Name VARCHAR(255),
TelephoneNumber VARCHAR(20),
Email VARCHAR(255),
PreferredAccommodationType VARCHAR(255),
MaxRent DECIMAL(10, 2),
StaffMemberName VARCHAR(255),
RegistrationDate DATE,
BranchOffice VARCHAR(255)
);

CREATE TABLE Lease (


LeaseNumber INT PRIMARY KEY,
ClientNumber INT,
ClientName VARCHAR(255),
ClientAddress VARCHAR(255),
PropertyNumber INT,
PropertyAddress VARCHAR(255),
MonthlyRent DECIMAL(10, 2),
PaymentMethod VARCHAR(255),
DepositPaid BIT,
LeaseDuration INT,
LeaseStartDate DATE,
LeaseEndDate DATE,
FOREIGN KEY (ClientNumber) REFERENCES Client(ClientNumber),
FOREIGN KEY (PropertyNumber) REFERENCES
Property(PropertyNumber)
);

CREATE TABLE Newspaper (


NewspaperName VARCHAR(255) PRIMARY KEY,
Address VARCHAR(255),
TelephoneNumber VARCHAR(20),
ContactName VARCHAR(255)
);

CREATE TABLE Advertisement (


PropertyNumber INT,
PropertyAddress VARCHAR(255),
Type VARCHAR(255),
NumberOfRooms INT,
Rent DECIMAL(10, 2),
AdvertisedDate DATE,
NewspaperName VARCHAR(255),
AdvertisementCost DECIMAL(10, 2),
FOREIGN KEY (PropertyNumber) REFERENCES
Property(PropertyNumber),
FOREIGN KEY (NewspaperName) REFERENCES
Newspaper(NewspaperName)
);

You might also like