PDA

View Full Version : Sql


robert123
04-10-02, 11:44
help me in finding the answer
Examine the structure of the EMPLOYEES table:
EMPLOYEE_ID NUMBER NOT NULL EMP_NAME VARCHAR2(30) JOB_ID VARCHAR2(20) DEFAULT 'SA_REP' SAL NUMBER COMM_PCT NUMBER MGR_ID NUMBER DEPARTMENT_ID NUMBER
You need to update the records of employees 103 and 115. The UPDATE statement you specify should update the rows with the values specified below:
JOB_ID: Default value specified for this column definition.SAL: Maximum salary earned for the job ID SA_REP.COMM_PCT: Default value specified for this commission percentage column, if any. If no default value is specified for the column, the value should be NULL.DEPARTMENT_ID: Supplied by the user during run time through substitution variable.
Which UPDATE statement meets the requirements?

A.
UPDATE employeesSET job_id = DEFAULTAND Sal = (SELECT MAX(sal) FROM employees WHERE job_id = 'SA_REP')AND comm_pct = DEFAULTAND department_id = &didWHERE employee_id IN (103,115);

B.
UPDATE employeesSET job_id = DEFAULTAND Sal = MAX(sal) AND comm_pct = DEFAULT OR NULLAND department_id = &didWHERE employee_id IN (103,115) AND job_id = 'SA_REP';

C.
UPDATE employeesSET job_id = DEFAULT, Sal = (SELECT MAX(sal) FROM employees WHERE job_id = 'SA_REP'), comm_pct = DEFAULT, department_id = &didWHERE employee_id IN (103,115);

D.
UPDATE employeesSET job_id = DEFAULT, Sal = MAX(sal), comm_pct = DEFAULT, department_id = &didWHERE employee_id IN (103,115)AND job_id = 'SA_REP';

E.
UPDATE employeesSET job_id = DEFAULT, Sal = (SELECT MAX(sal) FROM employees WHERE job_id = 'SA_REP'), comm_pct = DEFAULT OR NULL, department_id = &didWHERE employee_id IN (103,115);

alligatorsql.com
04-11-02, 10:01
Dear Robert,

this looks like a question out of an oracle test. I think the best way to find the answer is to create the table and run the different statements.

If you have special after that test - please post again ...

Regards
Manfred Peter
(Alligator Company)
http:/www.alligatorsql.com