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

Name: Aman Kumar UID: 19BCS1667 Class: CSE-5 C Subject: Database Management System Lab Subject Code: CSP-275

The document contains details of a student named Aman Kumar with UID 19BCS1667 from class CSE-5 C. It provides the code to create an EMP table to store employee details and then uses SQL queries on this table to 1) get the table description, 2) list all employee details, 3) list names and salaries between 1500-3500, 4) list names and managers with IDs 7902, 7566 or 7789, and 5) list employees in departments 10 or 20.

Uploaded by

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

Name: Aman Kumar UID: 19BCS1667 Class: CSE-5 C Subject: Database Management System Lab Subject Code: CSP-275

The document contains details of a student named Aman Kumar with UID 19BCS1667 from class CSE-5 C. It provides the code to create an EMP table to store employee details and then uses SQL queries on this table to 1) get the table description, 2) list all employee details, 3) list names and salaries between 1500-3500, 4) list names and managers with IDs 7902, 7566 or 7789, and 5) list employees in departments 10 or 20.

Uploaded by

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

Name: Aman Kumar

UID: 19BCS1667
Class: CSE-5 C
Subject: DATABASE MANAGEMENT SYSTEM LAB
Subject Code: CSP-275

a) Get the description EMP table.

CREATE TABLE EMP(Name Type,EMPNO NOT NULL NUMBER(4),ENAME VARCHAR2(10),JOB


VARCHAR2(9),MGR NUMBER(4),HIREDATE DATE,SAL NUMBER(7,2),COMM NUMBER(7,2),DEPTNO
NUMBER(3),AGE NUMBER(3),ESAL NUMBER);

b) List all employees details.

CREATE TABLE EMP(Name Type,EMPNO NUMBER(4),ENAME VARCHAR2(10),JOB VARCHAR2(9),MGR


NUMBER(4),HIREDATE DATE,SAL NUMBER(7,2),COMM NUMBER(7,2),DEPTNO NUMBER(3),AGE
NUMBER(3),ESAL NUMBER);

INSERT INTO EMP Values("Raj",45,"Raj","Manager",10,'2015-12-31',2300,67,15,45,9);

INSERT INTO EMP Values("Vivek",23,"Vivek","Salesman",12,'2014-01-21',2500,58,14,47,11);

INSERT INTO EMP Values("Ajay",35,"Ajay","Security Guard",23,'2013-03-32',1200,46,19,48,13);

INSERT INTO EMP Values("Shivam",45,"Shivam","Cleaner",34,'2013-04-23',1240,45,20,24,49);

INSERT INTO EMP Values("Mukesh",27,"Mukesh","Driver",56,'2012-12-25',3400,78,51,62,37);

SELECT * FROM EMP;


c) List all employee names and their salaries, whose salary lies between 1500/- and 3500/-
both inclusive.

CREATE TABLE EMP(Name Type,EMPNO NUMBER(4),ENAME VARCHAR2(10),JOB VARCHAR2(9),MGR


NUMBER(4),HIREDATE DATE,SAL NUMBER(7,2),COMM NUMBER(7,2),DEPTNO NUMBER(3),AGE
NUMBER(3),ESAL NUMBER);

INSERT INTO EMP Values("Raj",45,"Raj","Manager",10,'2015-12-31',2300,67,15,45,9);

INSERT INTO EMP Values("Vivek",23,"Vivek","Salesman",12,'2014-01-21',2500,58,14,47,11);

INSERT INTO EMP Values("Ajay",35,"Ajay","Security Guard",23,'2013-03-32',1200,46,19,48,13);

INSERT INTO EMP Values("Shivam",45,"Shivam","Cleaner",34,'2013-04-23',1240,45,20,24,49);

INSERT INTO EMP Values("Mukesh",27,"Mukesh","Driver",56,'2012-12-25',3400,78,51,62,37);

SELECT Name,SAL FROM EMP WHERE SAL>=1500 AND SAL<=3500;

d) List all employee names and their and their manager whose manager is 7902 or 7566 0r
7789.

CREATE TABLE EMP(Name Type,EMPNO NUMBER(4),ENAME VARCHAR2(10),JOB VARCHAR2(9),MGR


NUMBER(4),HIREDATE DATE,SAL NUMBER(7,2),COMM NUMBER(7,2),DEPTNO NUMBER(3),AGE
NUMBER(3),ESAL NUMBER);

INSERT INTO EMP Values("Raj",45,"Raj","Manager",7902,'2015-12-31',2300,67,15,45,9);

INSERT INTO EMP Values("Vivek",23,"Vivek","Salesman",12,'2014-01-21',2500,58,14,47,11);

INSERT INTO EMP Values("Ajay",35,"Ajay","Security Guard",7566,'2013-03-32',1200,46,19,48,13);

INSERT INTO EMP Values("Shivam",45,"Shivam","Cleaner",34,'2013-04-23',1240,45,20,24,49);

INSERT INTO EMP Values("Mukesh",27,"Mukesh","Driver",7789,'2012-12-25',3400,78,51,62,37);

SELECT Name FROM EMP WHERE MGR=7902 OR MGR=7566 OR MGR=7789;


e) List all employees who belongs to the department 10 or 20

CREATE TABLE EMP(Name Type,EMPNO NUMBER(4),ENAME VARCHAR2(10),JOB VARCHAR2(9),MGR


NUMBER(4),HIREDATE DATE,SAL NUMBER(7,2),COMM NUMBER(7,2),DEPTNO NUMBER(3),AGE
NUMBER(3),ESAL NUMBER);

INSERT INTO EMP Values("Raj",45,"Raj","Manager",7902,'2015-12-31',2300,67,10,45,9);

INSERT INTO EMP Values("Vivek",23,"Vivek","Salesman",12,'2014-01-21',2500,58,14,47,11);

INSERT INTO EMP Values("Ajay",35,"Ajay","Security Guard",7566,'2013-03-32',1200,46,19,48,13);

INSERT INTO EMP Values("Shivam",45,"Shivam","Cleaner",34,'2013-04-23',1240,45,20,24,49);

INSERT INTO EMP Values("Mukesh",27,"Mukesh","Driver",7789,'2012-12-25',3400,78,51,62,37);

SELECT Name FROM EMP WHERE DEPTNO=10 OR DEPTNO=20;

You might also like