0% found this document useful (0 votes)
3 views7 pages

DBMS PRG8 Lab

The document outlines the steps to develop an Employee Database using SQL queries, including creating tables, inserting records, and performing various operations such as comparison, logical, set, grouping, and sorting. It provides specific SQL commands for each operation and demonstrates how to query the database effectively. The final result confirms that the operations were executed successfully.

Uploaded by

joyalprincess
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)
3 views7 pages

DBMS PRG8 Lab

The document outlines the steps to develop an Employee Database using SQL queries, including creating tables, inserting records, and performing various operations such as comparison, logical, set, grouping, and sorting. It provides specific SQL commands for each operation and demonstrates how to query the database effectively. The final result confirms that the operations were executed successfully.

Uploaded by

joyalprincess
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/ 7

EX-NO : 8 DEVELOP EMPLOYEE DATABASE USING VARIOUS

QUERIES ( COMPARISON , LOGICAL , SET ,


DATE : SORTING , GROUPING OPERATORS )

AIM:
To implement Employee Database using various operations (set, sorting, grouping)
.

ALGORITHM:
QUERIES

Step-1: Create tables Employee and personal

create table Employee(empno int primary key,Name varchar(30),designation varchar(30),


gender varchar(10),age int,DOJ date,salary numeric(10,2));

create table personal(empno int primary key , Name varchar(30),DOB date);

Step-2: Insert Record into Employee Table and Perosonal

insert into Employee values


(101, "Arun","Manager","Male",45,"1990-08-12",28500),
(102,"Zaheer","Accountant","Male",25,"1995-02-15",8500),
(103,"Krish","Developer","Male",35,"2000-09-06",15500),
(104,"sarah","Manager","FeMale",19,"2002-03-25",20500),
(105,"Madheena","Developer","FeMale",33,"2004-02-07",12500),
(106,"Vishnu","Accountant","Male",20,"2009-08-28",18500),
(107,"Rahul","Manager","Male",29,"2007-08-18",30500),
(108,"Jenifer","Developer","FeMale",35,"2007-07-11",9500),
(109,"Moses","Manager","Male",35,"1989-08-1",20700);

insert into personal values


(101,"Arun","1990-02-09"),
(102,"Zaheer","1988-04-15"),
(103,"Krish","1990-02-09"),
(104,"sarah","1988-01-29"),
(105,"Madheena","1989-08-18"),
(106,"Vishnu","1992-06-20"),
(107,"Rahul","1988-01-22"),
(108,"Jenifer","1990-01-20"),
(109,"Moses","1979-02-10"),
(110,"JOHN","1990-01-19");
Step-3: View table Employee and Personal

select *from Employee;

Select *from personal;


VARIOUS OPERATIONS

1. Comparison Operation
select *from Employee where age>30;

select *from Employee where age<30;

2. Logical operation
select *from Employee where age>30 AND gender="FeMale";

select *from Employee where age<40 AND (designation="Accountant" OR designation="Developer");

select *from Employee where (designation<>"Developer" AND designation<>"Manager");


3. Set operation

UNION
select empno,Name from Employee union select empno,Name from personal;

INTERSECT
select empno,Name from Employee intersect select empno,Name from personal;

EXCEPT
select empno,Name from personal except select empno,Name from Employee;

4. GROUP BY
select designation,sum(salary) from Employee group by designation;
select gender,sum(salary) from Employee group by gender;

5. SORT
select *from EMployee order by Name;

select *from EMployee order by salary;


select *from EMployee order by age desc;

select *from EMployee order by gender;

RESULT:
The Above Result has been obtained successfully.

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