SQL>select tname from tab;
17) Display the name of the current user.
SQL>show user;
18) Display the names of employees working in depart number 10 or 20 or 40 or employees working as CLERKS,SALESMAN or ANALYST.
SQL>select ename from emp where deptno in(10,20,40) or job in(‘CLERKS’,'SALESMAN’,'ANALYST’);
19) Display the names of employees whose name starts with alaphabet S.
SQL>select ename from emp where ename like ‘S%’;
20) Display the Employee names for employees whose name ends with alaphabet S.
SQL>select ename from emp where ename like ‘%S’;
21) Display the names of employees whose names have second alphabet A in their names.
SQL>select ename from emp where ename like ‘_A%’;
22) select the names of the employee whose names is exactly five characters in length.
SQL>select ename from emp where length(ename)=5;
23) Display the names of the employee who are not working as MANAGERS.
SQL>select ename from emp where job not in(‘MANAGER’);
24) Display the names of the employee who are not working as SALESMAN OR CLERK OR ANALYST.
SQL>select ename from emp where job not in(‘SALESMAN’,'CLERK’,'ANALYST’);
25) Display all rows from emp table.The system should wait after every screen full of information.
SQL>set pause on;
26) Display the total number of employee working in the company.
SQL>select count(*) from emp;
27) Display the total salary beiging paid to all employees.
SQL>select sum(sal) from emp;
28) Display the maximum salary from emp table.
SQL>select max(sal) from emp;
29) Display the minimum salary from emp table.
SQL>select min(sal) from emp;
30) Display the average salary from emp table.
SQL>select avg(sal) from emp;
No comments:
Post a Comment