SQL Exam Questoins
SQL Exam Questoins
A .get
B . run
C. describe
D . spool
A. COMMIT...
B. MERGE...
C. UPDATE...
D. DELETE...
E. CREATE...
F. DROP...
Which statement shows the maximum salary paid in each job category of each department?
A. SELECT dept_id, job_cat, MAX (salary) FROM employees WHERE salary > MAX (salary);
B. SELECT dept_id, job_cat, MAX (salary) FROM employees GROUP BY dept_id, job_cat
C. SELECT dept_id, job_cat, MAX(salary) FROM employees;
D. SELECT dept_id, job_cat, MAX (salary) FROM employees GROUP BY dept_id;
E. SELECT dept_id, job_cat, MAX (salary) FROM employees GROUP BY dept_id, job_cat, salary
DEPARTMENTS
Column name Data Type Remarks
DEPARTMENT_ID NUMBER NOT NULL, Primary key
DEPARTMENT_NAME VARCHAR2(30)
MGR_ID NUMBER References MGR_ID column of the EMPLOYEES table
NEW EMPLYEES
EMPLOYEE_ID NUMBER Primary Key
NAME VARCHAR2(60)
12. Which SELECT statement should you use to extract the year form the system date and display it in
the format “1998”?
DEPARTMENTS
DEPARTMENT_ID DEPARTMENT_NAME
10 Sales
20 Marketing
30 Accounts
EMPLOYEES
LAST_NAME DEPARTMENT_ID SALARY
Get z 10 3000
Davis 10 1500
King 10 2200
DEPARTMENTS
DEPARTMENT_ID DEPARTMENT_NAME
10 Sales
10 Marketing
10 Accounts
15. Examine the data from the ORDERS and CUSTOMERS tables.
ORDERS
ORD_ID ORD_DATE CUST_ID ORD_TOTAL
100 12.JAN.2000 15 10000
101 09.MAR.2000 40 8000
102 09.MAR.2000 35 12500
103 15.MAR.2000 15 12000
104 25.JUN.2000 15 6000
105 18.JUL.2000 20 5000
106 18.JUL.2000 35 7000
107 21.JUL.2000 20 6500
108 04.AUG.2000 10 8000
CUSTOMERS
CUST_ID CUST_NAME CITY
10 Smith Los Angeles
15 Bob San Francisco
20 Martin Chicago
25 Mary New York
30 Rina Chicago
35 Smith New York
40 Linda New York
Write SQL statement retrieves the order ID, order date, customer name and, order total along with
maximum order total placed in the same day.