MGRID EMPCOUNT ----- -------- 1 0 2 2 5 1
MGRID EMPCOUNT ----- -------- 1 0 2 2 3 0 4 0 5 1
MGRID EMPCOUNT ----- -------- 1 3 2 3 3 3 4 3 5 3
MGRID EMPCOUNT ----- -------- 1 0 2 2 3 2 4 2 5 1
第1题:
Given the following function: CREATE FUNCTION emplist ( ) RETURNS TABLE ( id CHAR(6) , firstname VARCHAR(12) , lastname VARCHAR(15) ) LANGUAGE SQL BEGIN ATOMIC RETURN SELECT EMPNO, FIRSTNME, LASTNAME FROM EMPLOYEE WHERE WORKDEPT IN ('A00', 'B00'); END How can this function be used in an SQL statement?
第2题:
Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements inserts a row into the table? ()
第3题:
Which three statements inserts a row into the table?()
第4题:
Which SQL statement defines the FOREIGN KEY constraint on the DEPTNO column of the EMP table?()
第5题:
Examine the data of the EMPLOYEES table. EMPLOYEES (EMPLOYEE_ID is the primary key. MGR_ID is the ID of managers and refers to the EMPLOYEE_ID) EMP_NAME DEPT_ID MGR_ID JOB_ID SALARY EMPLOYEE_ID 101 Smith 20 120 SA_REP 4000 102 Martin 10 105 CLERK 2500 103 Chris 20 120 IT_ADMIN 4200 104 John 30 108 HR_CLERK 2500 105 Diana 30 108 HR_MGR 5000 106 Bryan 40 110 AD_ASST 3000 108 Jennifer 30 110 HR_DIR 6500 110 Bob 40 EX_DIR 8000 120 Ravi 20 110 SA_DIR 6500 Which statement lists the ID, name, and salary of the employee, and the ID and name of the employee's manager, for all the employees who have a manager and earn more than 4000?()
第6题:
Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2 (25) LAST_NAME VARCHAR2 (25) HIRE_DATE DATE Which UPDATE statement is valid? ()
第7题:
CREATE TABLE EMP (empno NUMBER(4), ename VARCNAR2(35), deptno NUMBER(7,2) NOT NULL CONSTRAINT emp_deptno_fk FOREIGN KEY deptno REFERENCES dept deptno);
CREATE TABLE EMP (empno NUMBER(4), ename VARCNAR2(35), deptno NUMBER(7,2) CONSTRAINT emp_deptno_fk REFERENCES dept (deptno));
CREATE TABLE EMP (empno NUMBER(4) ename VARCHAR2(35), deptno NUMBER(7,2) NOT NULL, CONSTRAINT emp_deptno_fk REFERENCES dept (deptno) FOREIGN KEY (deptno));
CREATE TABLE EMP (empno NUMBER(4), ename VARCNAR2(35), deptno NUMBER(7,2) FOREIGN KEY CONSTRAINT emp deptno fk REFERENCES dept (deptno));
第8题:
The statement executes successfully, leaves the manager ID as the existing value, and changes the salary to 4000 for the employees with ID 103 and 105.
The statement executes successfully, changes the manager ID to NULL, and changes the salary to 4000 for the employees with ID 103 and 105.
The statement executes successfully, changes the manager ID to NULL, and changes the salary to 3000 for the employees with ID 103 and 105.
The statement fails because there is more than one row matching the employee name Smith.
The statement fails because there is more than one row matching the IT_ADMIN job ID in the EMPLOYEES table.
The statement fails because there is no 'Administration' department in the DEPARTMENTS table.
第9题:
UPDATE employees SET first_name = 'John' SET last_name = 'Smith' WHERE employee_id = 180;
UPDATE employees SET first_name = 'John', SET last_name = 'Smoth' WHERE employee_id = 180;
UPDATE employee SET first_name = 'John' AND last_name = 'Smith' WHERE employee_id = 180;
UPDATE employee SET first_name = 'John', last_name = 'Smith' WHERE employee_id = 180;
第10题:
A check constraint on the EMPLOYEE table
A unique constraint on the EMPLOYEE table WORKDEPT column
A foreign key reference from the DEPARTMENT tables DEPTNO column to the WORKDEPT column of the EMPLOYEE table
A foreign key reference from the EMPLOYEE tables WORKDEPT column to the DEPTNO column of the DEPARTMENT table
第11题:
SELECT employee_id Emp_id, emp_name Employee, salary, employee_id Mgr_id, emp_name Manager FROM employees WHERE salary > 4000;
SELECT e.employee_id Emp_id, e.emp_name Employee,
salary,
employee_id Mgr_id, m.emp_name Manager FROM employees e, employees m WHERE e.mgr_id = m.mgr_id AND e.salary > 4000;
第12题:
UPDATE emp_hist SET employee_id, name, job_id, salary = (SELECT employee_id, name, job_id, salary FROM employees) WHERE employee_id IN (SELECT employee_id FROM employees);
MERGE INTO emp_hist eh USING employees e ON (eh.employee_id = e.employee_id) WHEN MATCHED THEN UPDATE SET eh.name = e.name, eh.job_id = e.job_id, eh.salary = e.salary WHEN NOT MATCHED THEN INSERT VALUES (e.employee id, e.name, job id, e.salary);
MERGE INTO emp_hist eh USING employees e ON (eh.employee_id = e.employee_id) WHEN MATCHED THEN UPDATE emp hist SET eh.name = e.name, eh.job_id = e.job_id, eh.salary = e.salary WHEN NOT MATCHED THEN INSERT INTO emp_hist VALUES (e.employees_id, e.name, e.job_id, e.salary);
MERGE INTO emp_hist eh USING employees e WHEN MATCHED THEN UPDATE emp_hist SET eh.name = e.name, eh.job_id = e.job_id, eh.salary = e.salary WHEN NOT MATCHED THEN INSERT INTO emp_hist VALUES (e.employees_id, e.name, e.job_id, e.salary);
第13题:
Given the following requirements: Create a table to contain employee data, with a unique numeric identifier automatically assigned when a row is added, has an EDLEVEL column that permits only the values 'C', 'H' and 'N', and permits inserts only when a corresponding value for the employee's department exists in the DEPARTMENT table. Which of the following CREATE statements will successfully create this table?()
第14题:
EMPLOYEES and DEPARTMENTS data: EMPLOYEES DEMP_NAME DEPT_ID MGR_ID JOB_ID SALARY EMPLOYEE_I 101 Smith 20 120 SA_REP 4000 102 Martin 10 105 CLERK 2500 103 Chris 20 120 IT_ADMIN 4200 104 John 30 108 HR_CLERK 2500 105 Diana 30 108 IT_ADMIN 5000 106 Smith 40 110 AD_ASST 3000 108 Jennifer 30 110 HR_DIR 6500 110 Bob 40 EX_DIR 8000 120 Ravi 20 110 SA_DIR 6500 DEPARTMENTS DEPARTMENT_ID DEPARTMENT_NAME 10 Admin 20 Education 30 IT 40 Human Resources On the EMPLOYEES table, EMPLOYEE_ID is the primary key. MGR_ID is the ID managers and refers to the EMPLOYEE_ID. On the DEPARTMENTS table DEPARTMENT_ID is the primary key. Evaluate this UPDATE statement. UPDATE employees SET mgr_id = (SELECT mgr_id FROM employees WHERE dept_id= (SELECT department_id FROM departments WHERE department_name = 'Administration')), Salary = (SELECT salary FROM employees WHERE emp_name = 'Smith') WHERE job_id = 'IT_ADMIN'; What happens when the statement is executed?()
第15题:
You discover that your Recycle Bin contains two tables with the same name, MY_TABLE. You also have a table named MY_TABLE in your schema. You execute the following statement: FLASHBACK TABLE my_table TO BEFORE DROP RENAME TO my_table2; What will be the result of executing this statement?()
第16题:
Examine the data in the EMPLOYEES and DEPARTMENTS tables: EMPLOYEES EMP_NAME DEPT_ID MGR_ID JOB_ID SALARY EMPLOYEE_ID 101 Smith 20 120 SA_REP 4000 102 Martin 10 105 CLERK 2500 103 Chris 20 120 IT_ADMIN 4200 104 John 30 108 HR_CLERK 2500 105 Diana 30 108 IT_ADMIN 5000 106 Smith 40 110 AD_ASST 3000 108 Jennifer 30 110 HR_DIR 6500 110 Bob 40 EX_DIR 8000 120 Ravi 20 110 SA*DIR 6500 DEPARTMENTS DEPARTMENT_ID DEPARTMENT_NAME 10 Admin 20 Education 30 IT 40 Human Resources Also examine the SQL statements that create the EMPLOYEES and DEPARTMENTS tables: CREATE TABLE departments (department_id NUMBER PRIMARY KEY, department _ name VARCHAR2(30)); CREATE TABLE employees (EMPLOYEE_ID NUMBER PRIMARY KEY, EMP_NAME VARCHAR2(20), DEPT_ID NUMBER REFERENCES departments(department_id), MGR_ID NUMBER REFERENCES employees(employee id), MGR_ID NUMBER REFERENCES employees(employee id), JOB_ID VARCHAR2(15). SALARY NUMBER); ON the EMPLOYEES, On the EMPLOYEES table, EMPLOYEE_ID is the primary key. MGR_ID is the ID of managers and refers to the EMPLOYEE_ID. DEPT_ID is foreign key to DEPARTMENT_ID column of the DEPARTMENTS table. On the DEPARTMENTS table, DEPARTMENT_ID is the primary key. Examine this DELETE statement: DELETE FROM departments WHERE department id = 40; What happens when you execute the DELETE statement?()
第17题:
Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) HIRE_DATE DATE Which UPDATE statement is valid?()
第18题:
The EMPLOYEE table contains the following information: EMPNO NAME WORKDEPT 101 SAM A11 102 JOHN C12 103 JANE -104 PAT Remote 105 ANNE -106 BOB A11 The MANAGER table contains the following information: MGRID NAME DEPTNO EMPCOUNT 1 WU B01 - 2 JONES A11 - 3 CHEN - - 4 SMITH - -5 THOMAS C12 - After this statement is executed: UPDATE manager m SET empcount = (SELECT COUNT(workdept) FROM employee e WHERE workdept=m.deptno) What is the result of the following query?() SELECT mgrid, empcount FROM MANAGER WHERE empcount IS NOT NULL ORDER BY mgrid
第19题:
MGRID EMPCOUNT ----- -------- 1 0 2 2 5 1
MGRID EMPCOUNT ----- -------- 1 0 2 2 3 0 4 0 5 1
MGRID EMPCOUNT ----- -------- 1 3 2 3 3 3 4 3 5 3
MGRID EMPCOUNT ----- -------- 1 0 2 2 3 2 4 2 5 1
第20题:
SELECT TABLE(EMPLIST()) FROM EMPLOYEE
SELECT TABLE(EMPLIST()) AS t FROM EMPLOYEE
SELECT EMPLIST(id, firstname, lastname) FROM EMPLOYEE
SELECT id, firstname, lastname FROM TABLE(EMPLIST()) AS t
第21题:
CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED ALWAYS AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1), PRIMARY KEY emp_pk (empno), FOREIGN KEY emp_workdept_fk ON (workdept) REFERENCES department (deptno), CHECK edlevel_ck VALUES (edlevel IN ('C','H','N')), );
CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK edlevel VALUES ('C','H','N') );
CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1) CHECK IN ('C','H','N')), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY department (deptno) REFERENCES (workdept) );
CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK (edlevel IN ('C','H','N')) );
第22题:
UPDATE employees SET first_name = 'John' SET last_name ='Smith' WHERE employee_id = 180;
UPDATE employees SET first_name = 'John', SET last_name ='Smith' WHERE employee_id = 180;
UPDATE employees SET first_name = 'John' AND last_name ='Smith' WHERE employee_id = 180;
UPDATE employees SET first_name = 'John', last_name ='Smith' WHERE employee_id = 180;
第23题:
One of the tables is recovered from the Recycle Bin using a First In First Out (FIFO) approach.
One of the tables is recovered from the Recycle Bin using a Last In First Out (LIFO) approach.
Both the tables are recovered from the Recycle Bin with one table renamed to MY_TABLE2 and the other to a system-generated name.
None of the tables are recovered from the Recycle Bin, and the statement returns an error.