Professional Documents
Culture Documents
Ques 18) Retrieve all rows where name field contains the
word ‘Priya’ Ans) Select* from abhaykrishan_customer where
Fname like ‘Pr_ya%’
Ques 19) Retrieve all rows where city is New Delhi, Seoul or Manila.
Ans) Select* from abhaykrishan_customer where CITY in (‘New Delhi’, ‘Punjab
or Banglore’)
ENROLLMENTNO. P a g e 20 | 71
12224401719
ISM LAB FILE
ENROLLMENTNO. P a g e 21 | 71
12224401719
ISM LAB FILE
ENROLLMENTNO. P a g e 22 | 71
12224401719
ISM LAB FILE
ASSIGNMENT 3
Ques 1) Create table employee.
Ans) Steps:
• Create table abhaykrishan_employee1(Empid number(3), Fname
char(10), Lname varchar(10), Bdate date, Address varchar(10), Gender
char(6), Salary number(10), Depno number(5))
• Desc abhaykrishan_employee1
ENROLLMENTNO. P a g e 23 | 107
12624401719
ISM LAB FILE
ENROLLMENTNO. P a g e 24 | 107
12624401719
ISM LAB FILE
ENROLLMENTNO. P a g e 25 | 107
12624401719
ISM LAB FILE
Ques 5) List names of employees having salary between 30,000 and 50,000
Ans) Select Fname, Lname, salary from Shefali_emp where salary>=30000 and
salary<=50000
ENROLLMENTNO. P a g e 26 | 107
12624401719
ISM LAB FILE
ENROLLMENTNO. P a g e 27 | 107
12624401719
ISM LAB FILE
Ans) Select Fname, Lname from abhaykrishan_emp where Fname= ‘Megha’ and
Lname= ‘Sharma’
ENROLLMENTNO. P a g e 28 | 107
12624401719
ISM LAB FILE
ENROLLMENTNO. P a g e 29 | 107
12624401719
ISM LAB FILE
ENROLLMENTNO. P a g e 30 | 107
12624401719
ISM LAB FILE
Ques 15) Display those employees where salary is not equal to 20,000
Ans) Select* from abhaykrishan_emp where salary<>20000
ASSIGNMENT 4
Ques 1) Create table
employee. Ans) Steps:
• Create table abhaykrishan_employee(EmpNo number(3), Ename char(20)
not null, Salary number(10) not null, Commission number(4), Job
char(20), Deptno number(3))
• Desc abhaykrishan_employee
ENROLLMENTNO. P a g e 31 | 107
12624401719
ISM LAB FILE
ENROLLMENTNO. P a g e 32 | 107
12624401719
ISM LAB FILE
ENROLLMENTNO. P a g e 34 | 107
12624401719
ISM LAB FILE
ENROLLMENTNO. P a g e 35 | 107
12624401719
ISM LAB FILE
Ques 12) Update the commission to 10% of salary for all the employees
having salary greater than 50000
Ans) Steps:
ENROLLMENTNO. P a g e 37 | 107
12624401719
ISM LAB FILE
Ques 13) Find the name of lowest paid employee for each
manager. Ans) Select MIN(salary) from
abhaykrishan_employee3 group by DEPTNO
ENROLLMENTNO. P a g e 38 | 107
12624401719
ISM LAB FILE
Ques 15) Find the difference between highest and lowest salaries
Ans) Select MAX(salary)-MIN(salary) from abhaykrishan_employee3
Ques 16) List average salary for all the depts which have more than 2 People.
Ans) Select Avg(salary), Depno from abhaykrishan_employee3 group by Depno
having COUNT(distinct Empno)>1
ENROLLMENTNO. P a g e 39 | 107
12624401719
ISM LAB FILE
Ques 17) List jobs of all the employees where maximum salary is more
than 40000 Ans) Select JOB from abhaykrishan_employee3 group by
JOB having max(SALARY)>5000
Ques 18) List jobs and number of employees in each JOB. The result should
be in decreasing order.
Ans) Select JOB,count(distinct (empno)) from abhaykrishan_employee3 group
by JOB order by COUNT(empno) desc
ENROLLMENTNO. P a g e 40 | 107
12624401719
ISM LAB FILE
Ques 20) List total, Max, Min, Average salary of employees job wise.
Ans) Select JOB,Sum(salary), Avg(salary), Max(salary), Min(salary) from
abhaykrishan_employee3 where DEPNO=10 group by JOB having
avg(SALARY)>=10000
ENROLLMENTNO. P a g e 41 | 107
12624401719
ISM LAB FILE
ASSIGNMENT-5
Question. (1) create table course (CCODE number(5) primary key,CNAME
varchar(10) unique,FEE number(5))
ENROLLMENTNO. P a g e 42 | 107
12624401719
ISM LAB FILE
ENROLLMENTNO. P a g e 43 | 107
12624401719
ISM LAB FILE
ENROLLMENTNO. P a g e 44 | 107
12624401719
ISM LAB FILE
ENROLLMENTNO. P a g e 45 | 107
12624401719
ISM LAB FILE
(9) select * from student where ccode in(select ccode from student where
rollno=1) and rollno!=1
ENROLLMENTNO. P a g e 46 | 107
12624401719
ISM LAB FILE
(10) select sname from student,course where fee=(select MAX(Fee) from course)
and student,course=course.ccode
ASSIGNMENT-6
Question (1) Create table hotel and insert 3 records for the following attributes:-
Hotelno(primary key), Hotelname, city
ENROLLMENTNO. P a g e 47 | 107
12624401719
ISM LAB FILE
(2) Create table Room and insert 3 records into table:- Roomno(primary
key),hotelno(foreign key),type of room,price
(3) Create table guest and insert 3 records into table:- Guestno(primary
key),gname,gaddress
ENROLLMENTNO. P a g e 48 | 107
12624401719
ISM LAB FILE
(4) Create table booking and insert 3 records for the following fields:- Hotelno-
foreign key),guestno(foreign key),datefrom,dateto,roomno
ENROLLMENTNO. P a g e 49 | 107
12624401719