0% found this document useful (0 votes)
1 views

Employee Management System2[1]

The document outlines the structure and commands of an Employee Management System using SQL, detailing Data Definition Language (DDL) for creating, altering, and dropping tables, as well as Data Manipulation Language (DML) for inserting, updating, and deleting records. It also covers Data Control Language (DCL) for user access control, Transaction Control Language (TCL) for managing transactions, and various SQL clauses and joins for data retrieval. Finally, it emphasizes best practices in software development for building a secure and functional system.

Uploaded by

hadawaleshreya77
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)
1 views

Employee Management System2[1]

The document outlines the structure and commands of an Employee Management System using SQL, detailing Data Definition Language (DDL) for creating, altering, and dropping tables, as well as Data Manipulation Language (DML) for inserting, updating, and deleting records. It also covers Data Control Language (DCL) for user access control, Transaction Control Language (TCL) for managing transactions, and various SQL clauses and joins for data retrieval. Finally, it emphasizes best practices in software development for building a secure and functional system.

Uploaded by

hadawaleshreya77
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/ 14

Employee Management System

DDL(Data definition language):


Data Definition Language (DDL) is a subset of SQL used
to define and manage database structures. It includes
commands that help create, modify, and delete database
objects such as tables, indexes, and schemas. Here are
some key components of DDL.

1]create table :To create database object like


table,database,view etc. we use DDl command. syntax:

create table table_name ( column1 datatype (size), column2 datatype (size), ...
column n datatype (size)); example:
create table Employee( EmpId
number(15),
FirstName varchar2(15),
LastName varchar2(20),
Email varchar2(25),
PhoneNo varchar2(25),
Salary number(8)); output:
Empid First LastName Email PhoneNo salary
name

Alter table:once table is created in database we may


required to change the structure of database object
this can be done with the help of alter command.

Syntax:

Alter table table_name add columnname datatype;


OR

Alter table table_name drop columnname;

Example:

Alter table emp add department varchar(10);

OR

Alter table emp drop column salary; output:


Empid First LastName Email PhoneNo salary department
name

output:
Empid First LastName Email PhoneNo department
name

Drop table command:

This command can be use to remove the database object


from our dbms.

syntax:

drop table tablename; example:

drop table emp;

DML (data manipulation language):

DML is a set of command used to insert data into the


table. delete data from the table. update data of
the table.

1]Insert command:
To add a record into the table .
syntax:
insert into tablename values (column 1,column2….column n);

example:

insert into employee values (1 ,’priya’ ,’deshmukh’ ,’[email protected]


,’567894’,’co’);

output:
Emp_i Firs LastName Email PhoneN departmen
d t o t
name
1 priy deshmukh [email protected] 567894 co
a m
20 Riya deshpand [email protected] 896754 ME
e
30 siya mane [email protected] 987654 EJ
update
command:

update statement is used to modify the record present


in existing table. syntax:

update table_name set columnname =value where


condition; example:

update employee set eid =10 where eid=1;


output:

Emp_i Firs LastName Email PhoneN departmen


d t o t
name
10 priy deshmukh [email protected] 567894 CO
a m
20 Riya deshpand [email protected] 896754 ME
e
30 siya mane [email protected] 987654 EJ

Delete command:

Delete command is used to delete same or all record


from the existing table.

syntax:

delete from table_name where condition; example:

delete from employee where emp_id=’30’; output:


Emp_i Firs LastName Email PhoneN departmen
d t o t
name
10 priy deshmukh [email protected] 567894 CO
a m
20 Riya deshpand [email protected] 896754 ME
e

DCL(data control language):

DCL is used to control the user access to the databae


related element like tables,views,function.

1]grant
2]revoke

1]grant:it is used to provide preveledge to the user on


the database object the preveledges is
select,delete,insert,update on the table.

2]revoke:It is used to remove the preveledges given on


the database object ,all the preveledge be the remove
at a time or one or more preveledges can also be remove
from the object as per the requirement.

TCL(transaction control language):

TCL statement allows control &manage transaction to


maintain the integrity of data within sql statement.

1]commit

2]rollback 1]commit

command:

changes made to the database by insert,update&delete


command are temporary until explicitely commited these
is performed by commit command. syntax: commit;
example:

Emp_i Firs LastName Email PhoneN departmen


d t o t
name
10 priy deshmukh [email protected] 567894 CO
a m
20 Riya deshpand [email protected] 896754 ME
e
30 siya mane [email protected] 987654 EJ
update emp set emp_id=40 where
emp_id=20;
commit;
output:
Emp_i Firs LastName Email PhoneN departmen
d t o t
name
10 priy deshmukh [email protected] 567894 CO
a m
40 Riya deshpand [email protected] 896754 ME
e
30 siya mane [email protected] 987654 EJ
update emp set department=’ENTC’ where

department=’ME;

Emp_i Firs LastName Email PhoneN departmen


d t o t
name
10 priy deshmukh [email protected] 567894 CO
a m
40 Riya deshpand [email protected] 896754 ENTC
e
30 siya mane [email protected] 987654 EJ
rollback;
Emp_i Firs LastName Email PhoneN departmen
d t o t
name
10 priy deshmukh [email protected] 567894 CO
a m
40 Riya deshpand [email protected] 896754 ME
e
30 siya mane [email protected] 987654 EJ
clauses:

1]Group by clause

2]Having clause

3]order by clause

1]Group by clause:

group by clause is a clause which is used o output


result by grouping similar data .
1]display sum of salary by departmentwise select
dept_id, sum(salary) from emp group by dept_id;
output:
Dept_id salary
1 6000
2 12000
3 8000

2]Having clause:

having clase has conditional clause which check the


data for specific search condition. 1]display sum
of salary of department 10

select depe_id,sum(salary) from emp group by dept_id


having dept_id =’10’; output:
Dept_id salary
1 6000

3]order by clause:

to arrange the display rows in ascending or descending


order.

the order by keyword sort the record in ascending order


by default.

if you want to sort thr record in a descending order we


can desc keyword. syntax:
select *from tablename order by column1,column2(desc);
example:

we need to display the employee information in


ascending order select* from emp order by
ename; output:
EmployeeID Ename DeptID Salary Dname Dloacation
1007 Alice 3 3500 Finance Mumbai
1002 Anna 1 3500 HR Mumbai
1004 David 2 5000 IT New Delhi
1003 James 1 2500 HR Mumbai
1001 John 2 4000 IT New Delhi
1005 Mark 2 3000 IT New Delhi
1006 steve 3 4500 Finance Mumbai

joins:

join is the combining coumn from one or more table by


using values common to each.

Type of join:

1]Inner join

2]outer join

1]left outer join

2]right outer join


Inner join:

The inner join is used to display the record that have


matching values in both table.

syntax:

select columnname from table1 inner join table2 ON


table1.columnname=table2.columnname; emp:
Emp_id Dept_id
101 10

102 20

103 30

104 50
dept:
dept_id Dept_name
10 co

20 Me

30 ej

40 ce
example:

select emp_id,dep_id,dept_name from emp inner join dept


on emp.dept_id=dept.dept.dept_id; output:
Emp_id Dept_id Dept name
101 10 co

102 20 me

103 30 ej

104 50 ce
outer join:

outer join is base on both match &unmatch data left


outer join &right outer join.

left outer join:

the sql left outer join return all the rows from the
left table even if there are no matches in the right
table null values are place of right table. syntax:

select columnname from table1 left outer join table2 ON


table1.columnname=table2.columnname; example:

select emp_id,dep_id,dept_name from emp left outer join


dept on emp.dept_id=dept.dept.dept_id;
output:
Emp_id Dept_id Dept name
101 10 co

102 20 me

103 30 ej

104 NULL NULL

right outer

join:

the sql right outer join return all the rows from the
left table even if there are no matches in the left
table null values are place of left table. syntax:

select columnname from table1 right outer join table2


ON table1.columnname=table2.columnname; example:

select emp_id,dep_id,dept_name from emp right outer


join dept on emp.dept_id=dept.dept.dept_id;

output:
Emp_id Dept_id Dept name
101 10 co

102 20 me

103 30 ej

NULL NULL Ce
conclusion:

building an Employee Management System involves various components:


user authentication, data storage, performance tracking, and payroll
management. By breaking down the project into key modules and adopting
best practices in software development, you can create a highly functional
and secure system.
reference :
GitHub or GitLab for code version control and collaboration.
Follow coding standards and ensure proper documentation
(README files, code comments, etc.).
Use Issue Tracking and Pull Requests to manage tasks and code
reviews.

You might also like