Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please answer the following queries based on the emp table. SQL> select * from emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 300 500
Please answer the following queries based on the emp table. SQL> select * from emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 300 500 1400 7369 SMITH 7499 ALLEN 7521 WARD 7566 JONES 7654 MARTIN 7698 BLAKE 7782 CLARK 7788 SCOTT 7839 KING 7844 TURNER 7876 ADAMS CLERK SALESMAN SALESMAN MANAGER SALESMAN MANAGER MANAGER ANALYST PRESIDENT SALESMAN CLERK 7902 17-DEC-80 7698 20-FEB-81 7698 22-FEB-81 7839 02-APR-81 7698 28-SEP-81 7839 01-MAY-81 7839 09-JUN-81 7566 19-APR-87 17-NOV-81 7698 08-SEP-81 7788 23-MAY-87 800 1600 1250 2975 1250 2850 2450 3000 5000 1500 1100 20 30 30 20 30 30 10 20 10 30 20 EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 7900 JAMES 7902 FORD 7934 MILLER CLERK ANALYST CLERK 7698 03-DEC-81 7566 03-DEC-81 7782 23-JAN-82 950 3000 1300 30 20 10 14 rows selected. SQL> select distinct job from emp; A JOB B JOB JOB D JOB CLERK SALESMAN PRESIDENT MANAGER ANALYST CLERK SALESMAN PRESIDENT CLERK SALESMAN PRESIDENT CLERK ANALYST CLERK SALESMAN PRESIDENT CLERK SALESMAN SQL> select count(distinct job) from emp; B COUNT(DISTINCTJOB) COUNT(DISTINCTJOB) COUNT(DISTINCTJOB) D COUNT(DISTINCTJOB) 4 6 3 SQL> select ename from emp where sal > 3000; A ENAME B ENAME D ENAME ENAME KING FORD JONES SCOTT SQL> select ename from emp where deptng = 10 order by ename desc; B ENAME D ENAME ENAME ENAME CLARK KING MILLER MILLER KING CLARK MILLER CLARK KING KING MILLER CLARK SQL> select avg(sal) from emp where deptno = 20; A B AVG(SAL) AVG(SAL) AVG(SAL) D AVG(SAL) 2175 2916.66667 1566.66667
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started