●Que1 :-Create following table :-
1.create employee table.
Eg. Create table employee(Eno integer primary key, Ename varchar(10), job
Varchar(10), Mgr_no integer, Jdate date, Sal integer, comm integer, Deptno Integer,foreign key(deptno) references dept(deptno));
2. Create Dept table.
Eg. Create table dept(deptno integer primary key, dname varchar(10), Location Varchar(10));
3. Insert record in employee table.
Eg. Insert into employee values(7369,Smith,Clerk,7902,1980-12-17,800,--,20);
4. Insert record in dept table.
Eg. Insert into dept values(10,P.A,Bangalore);
5. Find the name of all employee having L second letter in their name.
Eg. Select name from employee where ename like _l%;
6. Find the list of employee who stay in Bombay & Delhi.
Eg. Select * from employee,dept where location in (Bombay,Delhi);
7. List the name and city of employee who are not in surat.
Eg. Selece ename,location from employee,dept
where location not in (Surat);
8. Display the salary for employee whose salary 10001 & 10002.
Eg. Select sal from employee where sal between 10001 and 10002;
9. Count the total no of employee.
Eg. Slect count(ename) of employee;
10.Fild the employee whose salary is > 5000.
Eg. Select * from employee where sal>5000;
11.Calculate the average salary of all employees.
Eg. Select avg(sal) from employee;
12.Count the no of employee having salary > 5000.
Eg. Select count(ename) from employee where sal>5000;
13.Calculate the salary 0.30 for those employee whose salary is >= 5000.
Eg. Select (sal*0.30) from employee where sal>5000;
14.Write a query that counts the no of employee whose second character
names are r & h.
Eg. Select count(ename) from employee where ename like _r% and
Ename like _h%;
15.Find the employee name have join date 23-jan-82
Eg.select ename from employee where jdate=1982-01-23’;
16.Find the employee name working in department other than 20.
Eg. Select ename from employee where deptno not in 20;
17.Find the employee name who do not receive commission.
Eg. select ename from employee where comm=--;
18.Find the employee name whose name start with j and ends with s.
Eg. Select emane from employee where ename like j% and ename like %s;
19.Find the employee name who have join date 1982.
Eg.select ENAME from EMPLOYEE where TO_CHAR(JDATE,YYYY)=’1982;
20.Find the total no of clerk.
Eg.select count(ename) from employee where ename=clerk;
21.Find the maximum, minimum salary of various category of employee.
Eg.select max(sal),min(sal) from employee;
22.List all the clerks and managers from department no 20.
Eg.select ename from employee where (ename=clerks or ename=manager)
And deptno=20;
Comments
Post a Comment