You want to
display the names of all employees whose salaries belong to GRADE 5. Which SQL statements give
the required output? (Choose all that apply)
A. SELECT ename
FROM emp JOIN salgrade
USING (sal BETWEEN losal AND hisal) AND grade = 5;
B. SELECT ename
FROM emp e JOIN salgrade s
ON (e.sal BETWEEN s.losal AND s.hisal AND s.grade = 5);
C. SELECT ename
FROM emp e JOIN salgrade s
ON (e.sal BETWEEN s.losal AND s.hisal) AND s.grade = 5;
D. SELECT ename
FROM emp e JOIN salgrade s
ON (e.sal BETWEEN s.losal AND s.hisal) WHERE s.grade=5;
SELECT ename
E.
FROM emp e JOIN salgrade s
WHERE e.sal BETWEEN s.losal AND s.hisal AND s.grade = 5;
1a "Exhibit"
EMP
Name Null? Type
SALGRADE
GRADE NUMBER
LOSAL NUMBER
HISAL NUMBER
2. View the Exhibit and examine the structure of the DEPARTMENTS and LOCATIONS tables. You
want to display all the cities and the corresponding departments in them, if any. Which query would
give you the required output?
A. SELECT location_id LOC, city, department_id DEPT
FROM locations LEFT OUTER JOIN departments
USING (location_id);
B. SELECT location_id LOC, city, department_id DEPT
FROM locations RIGHT OUTER JOIN departments
USING (location_id);
2a "Exhibit"
DEPARTMENTS
Name Null? Type
LOCATIONS
LOCATION_ID NUMBER(4)
STREET_ADDRESS NOT NULL VARCHAR2(40)
POSTAL_CODE VARCHAR2(12)
CITY VARCHAR2(30)
STATE_PROVINCE NOT NULL VARCHAR2(25)
COUNTRY_ID CHAR(2)
> 3. View the Exhibit and examine the structure of the EMPLOYEES and DEPARTMENTS tables. You
want to display the last names and hire dates of all latest hires in their respective departments in the
location ID 1700. You issue the following query:
It generates an error because the GROUP BY clause cannot be used with table joins in a
D.
subquery
3a "Exhibit"
EMPLOYEES
Name Null? Type
DEPARTMENTS
4a "Exhibit"
LOCATIONS
Name Null? Type
DEPARTMENTS
For which columns would an index be generated automatically? (Choose all that apply)
A. EMP_NO
B. SALARY
C. JOB_ID
D. DEPT_NO
E. EMP_NAME
8. View the Exhibit and examine the structure of the EMP table belonging to the user SCOTT. The
EMP table contains the details of all the current employees in your organization.
EMPNO is the PRIMARY KEY.
User SCOTT has created an ENAME_IDX index on the ENAME column and an EMP_VW view that
displays the ENAME and SALARY columns.
The recyclebin is enabled in the database. SCOTT executes the following command:
SQL> DROP TABLE emp;
Which details would be stored in the recycle bin? (Choose all that apply)
A. EMP_VW
B. ENAME_IDX
8a "Exhibit”
EMP
Name Null? Type
DOCNO
123-456-7890
233-67-90876
45-789-23456
SUBSTR
456
67
789
B. SELECT REGEXP_SUBSTR(docno,'^-[^-]+-')"SUBSTR"
FROM doc_details;
10. View the Exhibit and examine a sample of the data existing in the STORES table.
You need to generate a report that shows the following details:
Answers
1. BCD
2. A
3. B
4. A
5. AD
6. C
7. AE
8. BCE
9. D
10. B