0% found this document useful (0 votes)
7 views9 pages

DBMS Assignment

The document presents a case study on ShadoInk, a digital growth agency, detailing its database management system (DBMS) structure. It includes an entity-relationship model, functional dependencies, normalization processes, and SQL commands for creating and managing client, project, team member, project assignment, and payment tables. The document emphasizes the adherence to normalization rules and provides examples of data retrieval and manipulation queries.

Uploaded by

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

DBMS Assignment

The document presents a case study on ShadoInk, a digital growth agency, detailing its database management system (DBMS) structure. It includes an entity-relationship model, functional dependencies, normalization processes, and SQL commands for creating and managing client, project, team member, project assignment, and payment tables. The document emphasizes the adherence to normalization rules and provides examples of data retrieval and manipulation queries.

Uploaded by

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

ShadoInk-A digital growth

agency
DBMS CASE STUDY

Submitted By: Rahul



Submitted To: Dr. Puneet Kumar
it e_address
Service_type webs
ShadoInk Email

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_id Name Budget Start Date End Date Client_id

Project Assignment

Assignment_id Date

Team Members

TeamMember_id Name Employment type Role

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 (

ClientID VARCHAR(10) PRIMARY KEY,

CompanyName VARCHAR(100),

ContactPerson VARCHAR(100),

Email VARCHAR(100),

PhoneNumber VARCHAR(20)

);

CREATE TABLE IF NOT EXISTS Project (

ProjectID VARCHAR(10) PRIMARY KEY,

ClientID VARCHAR(10),

ProjectName VARCHAR(100),

StartDate DATE,

EndDate DATE,

Budget DECIMAL(10, 2),

FOREIGN KEY (ClientID) REFERENCES Client(ClientID)

);

CREATE TABLE IF NOT EXISTS TeamMember (

TeamMemberID VARCHAR(10) PRIMARY KEY,

Name VARCHAR(100),

Role VARCHAR(50),

EmploymentType VARCHAR(20),

ContactInformation VARCHAR(100)

);

CREATE TABLE IF NOT EXISTS ProjectAssignment (

AssignmentID VARCHAR(10) PRIMARY KEY,

ProjectID VARCHAR(10),

TeamMemberID VARCHAR(10),

AssignmentDate DATE,

EndDate DATE,

FOREIGN KEY (ProjectID) REFERENCES Project(ProjectID),

FOREIGN KEY (TeamMemberID) REFERENCES TeamMember(TeamMemberID)

);

CREATE TABLE IF NOT EXISTS Payment (

PaymentID VARCHAR(10) PRIMARY KEY,

TeamMemberID VARCHAR(10),

PaymentDate DATE,

Amount DECIMAL(10, 2),

PaymentType VARCHAR(20),

FOREIGN KEY (TeamMemberID) REFERENCES TeamMember(TeamMemberID)

);

-- Insert data into tables

INSERT INTO Client (ClientID, CompanyName, ContactPerson, Email, PhoneNumber)

VALUES ('C001', 'ABC Inc.', 'John Doe', '[email protected]', '1234567890');

INSERT INTO Project (ProjectID, ClientID, ProjectName, StartDate, EndDate, Budget)

VALUES ('P001', 'C001', 'Project Alpha', '2023-01-01', '2023-12-31', 100000.00);

INSERT INTO TeamMember (TeamMemberID, Name, Role, EmploymentType, ContactInformation)

VALUES ('TM001', 'Bob Smith', 'Developer', 'Freelance', '[email protected]');

INSERT INTO ProjectAssignment (AssignmentID, ProjectID, TeamMemberID, AssignmentDate, EndDate)

VALUES ('A001', 'P001', 'TM001', '2023-01-01', '2023-12-31');

INSERT INTO Payment (PaymentID, TeamMemberID, PaymentDate, Amount, PaymentType)

VALUES ('PY001', 'TM001', '2023-01-15', 5000.00, 'Commission');

-- Retrieve all clients

SELECT * FROM Client;

-- Retrieve all projects for a client

SELECT * FROM Project WHERE ClientID = 'C001';

-- Update a client's contact information

UPDATE Client SET ContactPerson = 'Jane Doe', Email = '[email protected]'

WHERE ClientID = 'C001';

-- Delete a client

-- DELETE FROM Client WHERE ClientID = 'C001'; -- Commented out to prevent accidental deletion

-- Retrieve all team members

SELECT * FROM TeamMember;

-- Assign a team member to a project

-- Already inserted in the ProjectAssignment table

-- Retrieve all team members assigned to a project

SELECT TM.* FROM TeamMember TM

JOIN ProjectAssignment PA ON TM.TeamMemberID = PA.TeamMemberID

WHERE PA.ProjectID = 'P001';

-- Make a payment to a team member

-- Already inserted in the Payment table

-- Retrieve all payments made to a team member

SELECT * FROM Payment WHERE TeamMemberID = 'TM001';

-- Calculate total payments made to all team members

SELECT SUM(Amount) AS TotalPayments FROM Payment;

-- Find projects with no assigned team members

SELECT * FROM Project WHERE ProjectID NOT IN (SELECT ProjectID FROM ProjectAssignment);

-- List all clients with their projects

SELECT C.CompanyName, P.ProjectName FROM Client C

JOIN Project P ON C.ClientID = P.ClientID;

-- Find team members who have not received payments

SELECT * FROM TeamMember WHERE TeamMemberID NOT IN (SELECT TeamMemberID FROM Payment);

-- Retrieve the total budget of all projects for a client

SELECT SUM(Budget) AS TotalBudget FROM Project WHERE ClientID = 'C001';

-- List all projects with their assigned team members

SELECT P.ProjectName, TM.Name FROM Project P

JOIN ProjectAssignment PA ON P.ProjectID = PA.ProjectID

JOIN TeamMember TM ON PA.TeamMemberID = TM.TeamMemberID;

You might also like