0% found this document useful (0 votes)
11 views5 pages

DBMS3 4

database management system project

Uploaded by

haiderjaleel349
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)
11 views5 pages

DBMS3 4

database management system project

Uploaded by

haiderjaleel349
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/ 5

Data Base and Management

System Project Phase 4

Project Title: Disaster Relief Management

GROUP MEMBERS:

NAME: ENROLLMENT: SECTION:


JALEEL HAIDER 01-134222-070 BS(CS)-4A
ABDUL SATTAR 01-134222-005 BS(CS)-4A
ABDUL HADI 01-134222-004 BS(CS)-4A

1|Pag
e
1NF (First Normal Form):
To bring the tables into 1NF, we need to ensure that each attribute holds atomic values.
Since our tables are already atomic, no further modifications are required.

2NF (Second Normal Form):


Partial Dependency:
In the Staff table, Salary is partially dependent on the primary key Staff_id, as it is functionally
dependent only on Staff_id, not on the entire composite key.

To address the 2NF errors, we'll create separate tables for the attributes causing partial
dependencies.
Additional Tables:
Staff_Salary:
 Staff_Salary (Staff_id [FK], Salary)
Final Tables:

Staff:
 Staff (Staff_id [PK], Name, Email, Phone_number, Role, Department, Address)

Administration:
 Administration (Admin_id [PK], Name, Email, Phone_number, Position, Department, Address)

Disaster Report:
 Disaster_Report (Report_id [PK], Disaster_type, Location, Report_date, Description,
Report_status)

Donation:
 Donation (Donation_id [PK], Donor_name, Donor_email, Donor_phone, Donation_type,
Donation_amount, Donation_date, Donation_method)

Volunteer:
 Volunteer (Volunteer_id [PK], Name, Email, Phone_number, Availability, Skills, Address)

Staff_Salary:
 Staff_Salary (Staff_id [PK, FK], Salary)
.

3NF (Third Normal Form):


Normalized Tables:

Staff:
 Staff (Staff_id [PK], Name, Email, Phone_number, Role, Department, Address)

Administration:
 Administration (Admin_id [PK], Name, Email, Phone_number, Position, Department, Address)

2|Pag
e
Disaster Report:
 Disaster_Report (Report_id [PK], Disaster_type, Location, Report_date, Description,
Reporter_name, Reporter_contact)

Donation:
 Donation (Donation_id [PK], Donor_name, Donor_email, Donor_phone, Donation_type,
Donation_amount, Donation_date, Donation_method)

Volunteer:
 Volunteer (Volunteer_id [PK], Name, Email, Phone_number, Availability, Skills, Address)

System Log:
 System_Log (Log_id [PK], Timestamp, Action, User_id, Description)

Task B: DDL Scripts


Creating Tables
CREATE TABLE Staff (
Staff_id SERIAL PRIMARY KEY,
Name VARCHAR(100),
Email VARCHAR(100),
Phone_number VARCHAR(20),
Role VARCHAR(50),
Department VARCHAR(100),
Address TEXT
);

CREATE TABLE Administration (


Admin_id SERIAL PRIMARY KEY,
Name VARCHAR(100),
Email VARCHAR(100),
Phone_number VARCHAR(20),
Position VARCHAR(50),
Department VARCHAR(100),
Address TEXT
);

CREATE TABLE Disaster_Report (


Report_id SERIAL PRIMARY KEY,
Disaster_type VARCHAR(100),
Location VARCHAR(255),
Report_date DATE,
Description TEXT,
Report_status VARCHAR(50)
);

3|Pag
e
CREATE TABLE Donation (
Donation_id SERIAL PRIMARY KEY,
Donor_name VARCHAR(100),
Donor_email VARCHAR(100),
Donor_phone VARCHAR(20),
Donation_type VARCHAR(100),
Donation_amount DECIMAL(10, 2),
Donation_date DATE,
Donation_method VARCHAR(100)
);

CREATE TABLE Volunteer (


Volunteer_id SERIAL PRIMARY KEY,
Name VARCHAR(100),
Email VARCHAR(100),
Phone_number VARCHAR(20),
Availability TEXT,
Skills TEXT,
Address TEXT
);

CREATE TABLE Staff_Salary (


Staff_id INTEGER REFERENCES Staff(Staff_id),
Salary DECIMAL(10, 2),
PRIMARY KEY (Staff_id)
);

ADDING DATA
INSERT INTO Staff (Name, Email, Phone_number, Role, Department, Address)
VALUES ('John Doe', 'john@example.com', '1234567890', 'Manager', 'HR', '123 Main St');

INSERT INTO Disaster_Report (Disaster_type, Location, Report_date, Description, Report_status)


VALUES ('Earthquake', 'City A', '2024-06-01', 'Severe earthquake causing structural damage.',
'Resolved');

INSERT INTO Donation (Donor_name, Donor_email, Donor_phone, Donation_type, Donation_amount,


Donation_date, Donation_method)
VALUES ('Alice Smith', 'alice@example.com', '9876543210', 'Cash', 500.00, '2024-06-02', 'Online');

INSERT INTO Volunteer (Name, Email, Phone_number, Availability, Skills, Address)


VALUES ('Emily Johnson', 'emily@example.com', '5678901234', 'Weekends', 'First Aid, CPR', '456 Elm
St');

INSERT INTO Staff_Salary (Staff_id, Salary)


VALUES (1, 60000.00);

4|Pag
e
Basic CRUD Operations
SELECT * FROM Staff;

SELECT * FROM Staff WHERE Department = 'HR';

SELECT Report_id, Disaster_type, Location FROM Disaster_Report;

SELECT * FROM Donation WHERE Donation_type = 'Cash';

SELECT * FROM Volunteer WHERE Skills LIKE '%First Aid%';

SELECT s.Name, ss.Salary FROM Staff s INNER JOIN Staff_Salary ss ON s.Staff_id = ss.Staff_id;

Updating Data
UPDATE Staff SET Email = 'newemail@example.com' WHERE Staff_id = 1;

UPDATE Donation SET Donation_amount = 1000.00 WHERE Donation_id = 1;

Delete Data
DELETE FROM Volunteer WHERE Volunteer_id = 1;

DELETE FROM Disaster_Report WHERE Report_id = 1;

5|Pag
e

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