Brick Dbms - 1
Brick Dbms - 1
Battisputali, Kathmandu
1
Abstract
This report provides overview of Employee Management System (EMS) in the context of a
Database Management System (DBMS) is a comprehensive software solution designed to
efficiently manage and organize employee-related information within an organization. This
system leverages the capabilities of a DBMS to store, retrieve, update, and manipulate data,
ensuring the seamless management of various HR processes. The report will focus on Structured
Query Language (SQL). By utilizing a DBMS, the system ensures data integrity, security, and
scalability, allowing organizations to effectively handle their workforce-related needs.
II
ACKNOWLEDGEMENT
I would like to express my sincere gratitude and appreciation to all those who have contributed to
the successful completion of this Database Management System (DBMS) project.
First and foremost, I extend my heartfelt thanks to my project guide and mentor Professor Mr. Anil
Lamnichanne, for his invaluable guidance, constant encouragement, and insightful feedback
throughout the duration of this project. His expertise and support played a pivotal role in shaping
the direction and scope of the project.
I extend my appreciation to my friends and peers who provided assistance, constructive
discussions, and valuable insights that helped refine the project. Your inputs were instrumental in
overcoming challenges and improving the overall quality of the work.
To everyone who has been a part of this endeavor, whether directly or indirectly, your support has
been crucial, and I am truly thankful for your contributions.
II
Contents
Abstract ............................................................................................................................................ i
ACKNOWLEDGEMENT .............................................................................................................. ii
CHAPTER – 1: .............................................................................................................................. 5
Introduction to Employee Management System ........................................................................ 5
Chapter 2 ....................................................................................................................................... 7
Entity Relationship Model ........................................................................................................... 7
Chapter-3 ....................................................................................................................................... 9
Data Definition Language ............................................................................................................ 9
Create table:................................................................................................................................. 9
ALTER Statement ..................................................................................................................... 15
Add alter: ............................................................................................................................... 15
Alter drop;.............................................................................................................................. 20
ALTER MODIFY.................................................................................................................. 21
Chapter 4: .................................................................................................................................... 22
Data Manipulation Language .................................................................................................... 22
Insert .......................................................................................................................................... 22
Update: ...................................................................................................................................... 28
Delete: ........................................................................................................................................... 32
Chapter 5 ..................................................................................................................................... 33
Data Query Language (DQL) .................................................................................................... 33
And Operator: ............................................................................................................................ 34
Or operator ................................................................................................................................ 35
Not operator............................................................................................................................... 36
Wild card operator ..................................................................................................................... 37
SQL Joins: ................................................................................................................................. 39
Inner Join ............................................................................................................................... 39
Left join ................................................................................................................................. 40
Right join ............................................................................................................................... 41
Oder by clause ........................................................................................................................... 42
Group by clause ......................................................................................................................... 43
Nest Quires ................................................................................................................................ 44
II
CHAPTER – 1:
II
Training and Development: EMS can assist in tracking employee training needs and
progress. It can suggest relevant training programs based on career goals and performance
gaps.
Analytics and Reporting: The system generates various reports and analytics, such as
attendance summaries, performance evaluations, and turnover rates. These insights enable
data-driven decision-making.
Security and Access Control: An EMS enforces role-based access control, ensuring that
sensitive employee information is accessible only to authorized personnel.
Mobile Accessibility: Modern systems often offer mobile apps or responsive interfaces,
allowing employees and managers to access information and perform tasks on the go.
II
Chapter 2
This ER diagram represents the model of Employee Management System Entity. It shows all
visual instrument of database tables and the relation between Employee ,Department, Project,
Project, Performance and Evaluator.
Entites and Attributes
Employee: (performanceid,attendance id,emailid,dob,address,work ex,emp-id,dept-id)
Project: (proj.id,emp.id,project info,success indicator,dept.id)
Department: ( dept ID,name)
Performance: (proj.id,efficienct score,timliness score,perf.id,quality score,emp id,accuracy score)
Evaluator: ( evaluator id, emp id)
Description
Each entity contain primary key and unique keys
Their id 1 to 1, M to 1 relationship available
Relationship
Employee works on project
Employee evaluated Evaluator
Employee evaluated through Performance
Performance impacts Evaluator
Employee belongs Departments.
II
II
Chapter-3
A Data Definition Language (DDL) statement is a type of SQL (Structured Query Language)
statement used to define, manage, and manipulate the structure of a database and its objects.
DDL statements are primarily concerned with the creation, alteration, and deletion of database
objects such as tables, indexes, views, and schemas. They are essential for defining the database
schema and ensuring data integrity. Some common DDL statements include:
CREATE: Used to create new database objects like tables, indexes, views, and schemas.
For example, CREATE TABLE is used to create a new table in the database.
ALTER: Allows you to modify the structure of an existing database object. For instance,
ALTER TABLE can be used to add or drop columns from a table.
DROP: Used to delete database objects. DROP TABLE is used to delete an existing table
along with all its data.
TRUNCATE: Removes all the data from a table, but the table structure remains intact.
It's faster than the DELETE statement for removing all records.
RENAME: Changes the name of a database object. For example, RENAME can be used
to rename a table.
COMMENT: Adds comments or descriptions to database objects. It doesn't affect the
structure but can be useful for documentation.
GRANT/REVOKE: These statements are used to grant or revoke specific permissions or
privileges on database objects to users or roles.
Following are the schema relationship:
Employee: (performanceid,attendance id,emailid,dob,address,work ex,emp-id,dept-id)
Project: (proj.id,emp.id,project info,success indicator,dept.id)
Department: ( dept ID,name)
Performance: (proj.id,efficienct score,timliness score,perf.id,quality score,emp
id,accuracy score)
Evaluator: ( evaluator id, emp id)
Create table:
Employee
II
II
Project
II
Department
II
Performance table
II
Evaluator
II
ALTER Statement
Add alter:
Employee: phone no.
II
Project: Start Date
II
Department: location
II
Performance: feedback
II
Evaluator: evaluation date
II
Alter drop;
for employee
II
ALTER MODIFY
Employee; address
II
Chapter 4:
It is used to input new record in the relational table, update the domain values in table and delete
records from table.
Insert:
It is used to input new records in relational table. Insert into 5 record for each tables.
II
Employee:
II
Project:
II
Department:
II
Performance:
II
Evaluator:
II
Update:
It is used to change the domain values in an existing relational table.
PROJECT:
II
DEPARTMENT:
II
PERFORMANCE:
II
EVALUATOR:
II
Delete:
It is used to remove records from relational table.
Q1. Remove empid 1001 from employee
II
Chapter 5
II
And Operator:
It is used to define in where clause. If all of the given condition are proved, then it returns
information otherwise it doesn’t display the information.
Syntax;
Select column-name(lists)
From table name
Where condition(s);
Example
Employee (performance id , attention id, DOB, work ex, empid, depid)
Project (projectid, empid, project info, success indicator, depid)
Find performance id, attention id, DOB, work ex, empid, depid from employee where address is
pokhara work exp is 5 years .
II
Or operator
It is also used to define where clause. If anyone of a given condition is true then it returns the
information otherwise it doesn’t
Syntax
Select Column name (list)
From table, name
Where condition I or condition II
Example
Employee (performance id , attention id, DOB, work ex, empid, depid)
Project (projectid, empid, project info, success indicator, depid)
II
Not operator
II
Wild card operator
II
Find email id & DOB from employee where address start with d & ends with g
Find email id & DOB of the employee where address p at any position
II
SQL Joins:
It is used to retrieve the information from more than one type of table
Inner Join
It is used to retrieve the information from two or more relational table it returns by joining the
relational table with different keys.
Syntax
Select column name (list)
From table I
Inner join table II
Where table I. Column name = table II. Column name;
Example
Employee (performance id , attention id, DOB, work ex, empid, depid)
Project (projectid, empid, project info, success indicator, depid)
II
Left join
If A& B are two relational right & left table respectively then it returns matching value from A &
B reaming value from left table A.
Syntax
Select column name (list)
From table I
Left join table II
Where table I. Column name = table II. Column name;
Example
Employee (performance i, attention id, DOB, work ex, empid, depid)
Project (projectid, empid, project info, success indicator, depid)
II
Right join
If A& B are two relational right & left table respectively then it returns matching value from A &
B reaming value from right table A.
Syntax
Select column name (list)
From table I
Right join table II
Where table I. Column name = table II. Column name;
Example
Employee (performance id attention id, DOB, work ex, empid, depid)
Project (projectid, empid, project info, success indicator, depid)
II
Oder by clause
It used to manage the clause either in ascending order or descending order.
Syntax
Select column name
From table name
Where condition order by column name
Example
Employee (performance id attention id, DOB, work ex, empid, depid)
Project (projectid, empid, project info, success indicator, depid)
II
Group by clause
It used to group the same value & return a summary result
Syntax
Select column name
From table name
Where condition group by column name
Example
Employee (performance id attention id, DOB, work ex, empid, depid)
Project (projectid, empid, project info, success indicator, depid)
II
Nest Quires
It is the complete query embedded within another operation
Example 1
Employee (performance id attention id, DOB, work ex, empid, depid)
Project (projectid, empid, project info, success indicator, depid)
Example 2
II
Example 3
II
View
It is the virtual table based on the result set of sql statement.
Example
Employee (performance id attention id, DOB, work ex, empid, depid)
Project (projectid, empid, project info, success indicator, depid)
II