DBMS Assignment
DBMS Assignment
agency
DBMS CASE STUDY
ntact Client_ id
Co
Clients Company_name
Email
1
Give
n Project_ id
Start Date
Budget Projects Project_name
End Date
n:m Assigmnet_id
Assignment_Date Project Assignment
n
Assigned to
1 TeamMember_id
Employment_type
Role
Team Members
1 Name
Get
Amount n
Payment_id
Payment_type Payment Payment_Date
ER MODEL OF SHADOINK
Clients Relational Model
Client_id Contact Email Company name
Projects
Project Assignment
Assignment_id Date
Team Members
Payment
Payment_id Amount Type Date TeamMember_id
Functional Dependencies
Clien
Client ID → Company Name, Contact Person, Email, Phone Numbe
Explanation: The Client ID uniquely determines the other attributes of the client
Projec
Project ID → Project Name, Start Date, End Date, Budge
Client ID → (None directly, but it's a foreign key referencing Client
Explanation: The Project ID determines the project details. The Client ID is a foreign key and does not directly determine any
attributes within the Project table
Team Membe
Team Member ID → Name, Role, Employment Type, Contact Informatio
Explanation: The Team Member ID uniquely determines the other attributes of the team member
Project Assignmen
Assignment ID → Project ID, Team Member ID, Assignment Date, End Dat
Project ID, Team Member ID → Assignment Date, End Dat
Explanation: The Assignment ID is the primary key, but the combination of Project ID and Team Member ID also uniquely
determines the assignment details
Paymen
Payment ID → Team Member ID, Payment Date, Amount, Payment Typ
Team Member ID → (None directly, but it's a foreign key referencing Team Member
Explanation: The Payment ID determines the payment details. The Team Member ID is a foreign key and does not directly
determine any attributes within the Payment table.
Normalization Upto 3 NF
All tables are in 1NF as each column contains atomic values. Every cell contains a single value
All tables are in 2NF because there are no partial dependencies. For example, in the Project Assignment
table, the primary key is Assignment ID, but the non-key attributes depend on the combination of Project
ID and Team Member ID, which is not the primary key but a composite key in this context. However, since
Assignment ID is the PK, this table is in 2NF
All tables are in 3NF. There are no transitive dependencies where a non-key attribute depends on another
non-key attribute.
Each entity has clear functional dependencies, and there are no partial or transitive dependencies that
would violate 2NF or 3NF, respectively.
CREATE TABLE IF NOT EXISTS Client (
CompanyName VARCHAR(100),
ContactPerson VARCHAR(100),
Email VARCHAR(100),
PhoneNumber VARCHAR(20)
);
ClientID VARCHAR(10),
ProjectName VARCHAR(100),
StartDate DATE,
EndDate DATE,
);
Name VARCHAR(100),
Role VARCHAR(50),
EmploymentType VARCHAR(20),
ContactInformation VARCHAR(100)
);
ProjectID VARCHAR(10),
TeamMemberID VARCHAR(10),
AssignmentDate DATE,
EndDate DATE,
);
TeamMemberID VARCHAR(10),
PaymentDate DATE,
PaymentType VARCHAR(20),
);
-- Delete a client
-- DELETE FROM Client WHERE ClientID = 'C001'; -- Commented out to prevent accidental deletion
SELECT * FROM Project WHERE ProjectID NOT IN (SELECT ProjectID FROM ProjectAssignment);
SELECT * FROM TeamMember WHERE TeamMemberID NOT IN (SELECT TeamMemberID FROM Payment);