0% found this document useful (0 votes)
67 views3 pages

CB - En.u4cse19158-Dbms Lab 4 Assignment

The document describes the structure of 5 tables - DEPARTMENT, EMPLOYEE, SOFTWARE, STUDY, and 19 queries to be solved on these tables. The tables are created to store information about departments, employees, software developed by employees, and studies done by employees. The queries involve operations like selecting distinct values, counting rows, summing values after grouping, joining tables, and filtering on conditions.
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)
67 views3 pages

CB - En.u4cse19158-Dbms Lab 4 Assignment

The document describes the structure of 5 tables - DEPARTMENT, EMPLOYEE, SOFTWARE, STUDY, and 19 queries to be solved on these tables. The tables are created to store information about departments, employees, software developed by employees, and studies done by employees. The queries involve operations like selecting distinct values, counting rows, summing values after grouping, joining tables, and filtering on conditions.
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

DBMS LAB PRACTICE QUESTIONS

TABLE DEPARTMENT

CREATE TABLE department(

DEPTNUM NUMBER(5),

DEPTNAME VARCHAR2(30),

LOCATION VARCHAR2(30) default 'CHENNAI' ,

constraint pk_department primary key(deptnum)

);

TABLE EMPLOYEE

CREATE TABLE employee (

EMPNO NUMBER(5) PRIMARY KEY,

EMPNAME VARCHAR2(25) NOT NULL,

DOB DATE,

JOB VARCHAR2(30),

MANAGER VARCHAR2(25),

HIREDATE DATE,

SALARY NUMBER(10,2),

DEPTNUM NUMBER(5),

constraint fk_employee_deptnum foreign key(deptnum) references department(deptnum));


TABLE SOFTWARE

CREATE TABLE software (

EMPNO NUMBER(5) NOT NULL,

PACKAGE VARCHAR2(40),

LANGUAGE VARCHAR2(30),

DEVELOPCOST NUMBER(10,2),

SALESCOST NUMBER(10,2),

constraint fk_software_empno foreign key(empno) references employee(empno));

TABLE STUDY

CREATE TABLE study(

EMPNO NUMBER(5) NOT NULL UNIQUE

REFERENCES EMPLOYEE(EMPNO),

INSTITUTE VARCHAR2(50) default 'AMRITA SCHOOL OF ENGINEERING',

LOCATION VARCHAR2(30));

QUERIES TO BE SOLVED:
1. select distinct job from employee;
2. select count(empno), job from employee group by job;
3. select job, sum(salary) from employee group by job;
4. select job, sum(salary) from employee group by job having sum(salary) > 100000;
5. select count(empno), institute from study group by institute having institute like 'AMRITA
%';
6. select empname, institute from employee e join study s one.empno = s.empno where
institute like 'AMRITA%';
7. select * from employee where MANAGER is not null;
8. select count(package), language from software where developcost< 20000 group by
language;
9. select empname, package, salescost from employee e join software s one.empno =
s.empno where job = 'PROGRAMMER' order by salescostdesc;
10. select empname, dob from employee where EXTRACT(MONTH FROM DOB) = 6;
11. select empname, cast((sysdate-hiredate)/365 as int) as experience from employee
where job = 'PROGRAMMER' order by experience desc;
12. select empname, dob from employee where EXTRACT(MONTH FROM DOB) =
EXTRACT(MONTH FROM SYSDATE);
13. select empname from employee where job='PROGRAMMER' and empname like '_____';
14. select lower(package), upper(empname) from employee e join software s one.empno =
s.empno;
15. select * from department, study;
16. select deptname, empname, institute from department d join employee e on
d.deptnum = e.deptnum join study s ons.empno = e.empno where institute like 'AMRITA%';
17. select count(empno), deptname from employee natural join department group by
deptname having deptname='HEALTH CARE';
18. select deptname, avg(salary) from department d join employee e on d.deptnum =
e.deptnum group by deptname order by avg(salary) desc;
19. select e1.empname as employee, e2.manager from employee e1, employee e2 where
e1.manager = e2.manager;

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