0% found this document useful (0 votes)
83 views6 pages

EXP - 3 Nishkarsh Maitry RA1811003010422: Output

1. The document contains SQL queries to create an employee table with fields like employee number, name, department, salary, date of joining and branch. 2. Data is inserted for 5 employees from different departments and branches. 3. 10 SQL queries are written to retrieve data from the employee table based on various conditions like retrieving all fields, employee number and salary, average salary, number of employees etc.
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)
83 views6 pages

EXP - 3 Nishkarsh Maitry RA1811003010422: Output

1. The document contains SQL queries to create an employee table with fields like employee number, name, department, salary, date of joining and branch. 2. Data is inserted for 5 employees from different departments and branches. 3. 10 SQL queries are written to retrieve data from the employee table based on various conditions like retrieving all fields, employee number and salary, average salary, number of employees etc.
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/ 6

EXP -3

NISHKARSH MAITRY
RA1811003010422

SQL QUERY -
CREATE TABLE Employee(EMPNO varchar(5),EMP_NAME varchar(200),DEPT
varchar(200),SALARY INT(10),DOJ DATE,BRANCH VARCHAR(100));

INSERT INTO employee(EMPNO,EMP_NAME,DEPT,SALARY,DOJ,BRANCH)


VALUES('E101','AMIT','PRODUCTION',45000,’2000-03-12’,'BANGLORE');
INSERT INTO employee(EMPNO,EMP_NAME,DEPT,SALARY,DOJ,BRANCH)
VALUES('E102','AMIT','HR',70000,'2002-07-03','BANGLORE');
INSERT INTO employee(EMPNO,EMP_NAME,DEPT,SALARY,DOJ,BRANCH)
VALUES('E103','Sunita','MANAGER',120000,'2001-01-11','mysore');
INSERT INTO employee(EMPNO,EMP_NAME,DEPT,SALARY,DOJ,BRANCH)
VALUES('E105','Sunita','IT',67000,'2001-08-01','mysore');
INSERT INTO employee(EMPNO,EMP_NAME,DEPT,SALARY,DOJ,BRANCH)
VALUES('E106','mahesh','CIVIL',145000,'2003-09-20','Mumbai');

OUTPUT

1. Display all the fields of employee tablee


SELECT * FROM `employee`;

OUTPUT:

2. Retrieve employee number and their salary

SELECT EMPNO,SALARY FROM `employee`


3. Retrieve average salary of all employees

SELECT AVG(SALARY) FROM `employee`


4. Retrieve number of employee

SELECT EMPNO FROM `employee`

5. Retrieve distinct number of employee

SELECT DISTINCT EMPNO FROM `employee`

6. Retrieve total salary of employee group by employee name and count similar names

SELECT SUM(SALARY),EMP_NAME,COUNT(SALARY) FROM `employee` GROUP BY EMP_NAME;

7. Retrieve salary of employee which is greater than >120000

SELECT SALARY FROM `employee` WHERE SALARY>120000;


8. Display name of employee in descending order

SELECT EMP_NAME FROM `employee` ORDER BY EMP_NAME DESC;

9. Display details of employee whose name is AMIT and salary greater than 50000;

SELECT * FROM `employee` WHERE EMP_NAME='AMIT' AND SALARY>50000


10.Retrieve the employee names who reside in Mysore.

SELECT EMP_NAME FROM `employee` WHERE BRANCH='mysore';

You might also like