单项选择题

The EMPLOYEES table contains these columns:
EMPLOYEE_ID NUMBER(4)
ENAME VARCHAR2 (25)
JOB_ID VARCHAR2(10)
Which SQL statement will return the ENAME, length of the ENAME, and the numeric position of the letter "a" in the ENAME column, for those employees whose ENAME ends with a the letter "n"?()

A. SELECT ENAME, LENGTH(ENAME), INSTR(ENAME, 'a') FROM EMPLOYEES WHERE SUBSTR (ENAME, -1,1) = 'n';
B. SELECT ENAME, LENGTH(ENAME), INSTR(ENAME, ,-1,1) FROM EMPLOYEES WHERE SUBSTR (ENAME, -1,1) = 'n';
C. SELECT ENAME, LENGTH(ENAME), SUBSTR(ENAME, -1,1) FROM EMPLOYEES WHERE INSTR (ENAME, 1,1) = 'n';
D. SELECT ENAME, LENGTH(ENAME), SUBSTR(ENAME, -1,1) FROM EMPLOYEES WHERE INSTR (ENAME, -1,1) = 'n';


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

Examine the structure of the EMP_DEPT_VU view:
Column Name Type Remarks
EMPLOYEE_ID NUMBER From the EMPLOYEES table
EMP_NAME VARCHAR2(30) From the EMPLOYEES table
JOB_ID VARCHAR2(20) From the EMPLOYEES table
SALARY NUMBER From the EMPLOYEES table
DEPARTMENT_ID NUMBER From the DEPARTMENTS table
DEPT_NAME VARCHAR2(30) From the DEPARTMENTS table
Which SQL statement produces an error?()

A. SELECT * FROM emp_dept_vu;
B. SELECT department_id, SUM(salary) FROM emp_dept_vu GROUP BY department _ id;
C. SELECT department_id, job_id, AVG(salary) FROM emp_dept_vu GROUP BY department _ id, job_id;
D. SELECT job_id, SUM(salary) FROM emp_dept_vu WHERE department_id IN (10,20) GROUP BY job_id HAVING SUM (salary) > 20000
E. None of the statements produce an error; all are valid.

2.多项选择题Which four statements correctly describe functions that are available in SQL?()

A. INSTR returns the numeric position of a named character.
B. NVL2 returns the first non-null expression in the expression list.
C. TRUNCATE rounds the column, expression, or value to n decimal places.
D. DECODE translates an expression after comparing it to each search value.
E. TRIM trims the heading of trailing characters (or both) from a character string.
F. NVL compares two expressions and returns null if they are equal, or the first expression of they are not equal.
G. NULLIF compares twp expressions and returns null if they are equal, or the first expression if they are not equal.

3.单项选择题

Examine the structure of the EMPLOYEES and NEW_EMPLOYEES tables:
EMPLOYEES
EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2 (25)
LAST_NAME VARCHAR2 (25)
HIRE_DATE DATE
NEW EMPLOYEES
EMPLOYEE_ID NUMBER Primary Key
NAME VARCHAR2 (60)
Which DELETE statement is valid?()

A. DELETE FROM employees WHERE employee_id = (SELECT employee_id FROM employees);
B. DELETE * FROM employees WHERE employee_id = (SELECT employee_id FROM new_ employees);
C. DELETE FROM employees WHERE employee_id IN (SELECT employee_id FROM new_employees WHERE name = ('Carrey')'
D. DELETE * FROM employees WHERE employee_id IN (SELECT employee_id FROM new_employees WHERE last_ name = ('Carrey')'

6.单项选择题

You need to create a view EMP_VU. The view should allow the users to manipulate the records of only the employees that are working for departments 10 or 20.
Which SQL statement would you use to create the view EMP_VU?()

A. CREATE VIEW emp_vu AS   SELECT *   FROM employees   WHERE department_id IN (10,20);
B. CREATE VIEW emp_vu AS   SELECT *   FROM employees   WHERE department_id IN (10,20)   WITH READ ONLY;
C. CREATE VIEW emp_vu AS   SELECT *   FROM employees   WHERE department_id IN (10,20)   WITH CHECK OPTION;
D. CREATE FORCE VIEW emp_vu AS   SELECT *   FROM employees   WHERE department_id IN (10,20);
E. CREATE FORCE VIEW emp_vu AS   SELECT *   FROM employees   WHERE department_id IN (10,20)   NO UPDATE;

7.单项选择题

Evaluate the SQL statement:
SELECT ROUND(45.953, -1), TRUNC(45.936, 2)
FROM dual;
Which values are displayed?()

A. 46 and 45
B. 46 and 45.93
C. 50 and 45.93
D. 50 and 45.9
E. 45 and 45.93
F. 45.95 and 45.93

8.单项选择题Which SQL statement accepts user input for the columns to be displayed, the table name, and WHERE condition?()

A. SELECT &1, "&2" FROM &3 WHERE last_name = '&8';
B. SELECT &1, '&2' FROM &3 WHERE '& last_name = '&8';
C. SELECT &1, &2 FROM &3 WHERE last_name = '&8';
D. SELECT &1, '&2' FROM EMP WHERE last_name = '&8';

9.多项选择题

From SQL*Plus, you issue this SELECT statement:

You use this statement to retrieve data from a data table for()。

A. Updating
B. Viewing
C. Deleting
D. Inserting
E. Truncating

10.单项选择题

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?()

A. 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.
B. The statement executes successfully, changes the manager ID to NULL, and changes the salary to 4000 for the employees with ID 103 and 105.
C. The statement executes successfully, changes the manager ID to NULL, and changes the salary to 3000 for the employees with ID 103 and 105.
D. The statement fails because there is more than one row matching the employee name Smith.
E. The statement fails because there is more than one row matching the IT_ADMIN job ID in the EMPLOYEES table.
F. The statement fails because there is no 'Administration' department in the DEPARTMENTS table.