单项选择题Which SELECT statement should you use to extract the year from the system date and display it in the format "1998"?()

A.SELECT TO_CHAR(SYSDATE,'yyyy') FROM dual;
B.SELECT TO_DATE(SYSDATE,'yyyy') FROM dual;
C.SELECT DECODE(SUBSTR(SYSDATE, 8), 'YYYY') FROM dual;
D.SELECT DECODE(SUBSTR(SYSDATE, 8), 'year') FROM dual;
E.SELECT TO_CHAR(SUBSTR(SYSDATE, 8,2),'yyyy') FROM dual;


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题In which scenario would an index be most useful?()

A.The indexed column is declared as NOT NULL.
B.The indexed columns are used in the FROM clause.
C.The indexed columns are part of an expression.
D.The indexed column contains a wide range of values.

2.单项选择题

Evaluate these two SQL statements:
SELECT last_name, salary , hire_date
FROM EMPLOYEES
ORDER BY salary DESC;
SELECT last_name, salary , hire_date
FROM EMPLOYEESORDER BY 2 DESC;
What is true about them?()

A.The two statements produce identical results.
B.The second statement returns a syntax error.
C.There is no need to specify DESC because the results are sorted in descending order by default.
D.The two statements can be made to produce identical results by adding a column alias for the salary column in the second SQL statement.

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

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

4.多项选择题Click the Exhibit button and examine the data in the EMPLOYEES table. Which three subqueries work?()

A.SELECT * FROM employees where salary > (SELECT MIN(salary) FROM employees GROUP BY department_id);
B.SELECT * FROM employees WHERE salary = (SELECT AVG(salary) FROM employees GROUP BY department_id);
C.SELECT distinct department_id FROM employees WHERE salary > ANY (SELECT AVG(salary) FROM employees GROUP BY department_id);
D.SELECT department_id FROM employees WHERE salary > ALL (SELECT AVG(salary) FROM employees GROUP BY department_id);
E.SELECT last_name FROM employees WHERE salary > ANY (SELECT MAX(salary) FROM employees GROUP BY department_id);
F.SELECT department_id FROM employees WHERE salary > ALL (SELECT AVG(salary) FROM employees GROUP BY AVG(SALARY));

5.单项选择题Which SQL statement defines a FOREIGN KEY constraint on the DEPTNO column of the EMP table?()

A.CREATE TABLE EMP (empno NUMBER(4), ename VARCHAR2(35), deptno NUMBER(7,2) NOT NULL, CONSTRAINT emp_deptno_fk FOREIGN KEY deptno REFERENCES dept deptno);
B.CREATE TABLE EMP (empno NUMBER(4), ename VARCHAR2(35), deptno NUMBER(7,2) CONSTRAINT emp_deptno_fk REFERENCES dept (deptno));
C.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));
D.CREATE TABLE EMP (empno NUMBER(4), ename VARCHAR2(35), deptno NUMBER(7,2) FOREIGN KEY CONSTRAINT emp_deptno_fk REFERENCES dept (deptno));

6.单项选择题Click the Exhibit button and examine the data in the EMPLOYEES and DEPARTMENTS tables.You want to retrieve all employees, whether or not they have matching departments in the departments table. Which query would you use?()

A.SELECT last_name, department_name FROM employees NATURAL JOIN departments;
B.SELECT last_name, department_name FROM employees JOIN departments ;
C.SELECT last_name, department_name FROM employees e JOIN departments d ON (e.department_id = d.department_id);
D.SELECT last_name, department_name FROM employees e RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id);
E.SELECT last_name, department_name FROM employees FULL JOIN departments ON (e.department_id = d.department_id);
F.SELECT last_name, department_name FROM employees e LEFT OUTER JOIN departments d ON (e.department_id = d.department_id);

7.单项选择题Which SQL statement generates the alias Annual Salary for the calculated column SALARY*12?()

A.SELECT ename, salary*12 'Annual Salary' FROM employees;
B.SELECT ename, salary*12 "Annual Salary" FROM employees;
C.SELECT ename, salary*12 AS Annual Salary FROM employees;
D.SELECT ename, salary*12 AS INITCAP("ANNUAL SALARY") FROM employees

8.单项选择题What is true of using group functions on columns that contain NULL values?()

A.Group functions on columns ignore NULL values.
B.Group functions on columns returning dates include NULL values.
C.Group functions on columns returning numbers include NULL values.
D.Group functions on columns cannot be accurately used on columns that contain NULL values.
E.Group functions on columns include NULL values in calculations if you use the keyword INC_NULLS.

9.多项选择题Which two statements about sequences are true? ()

A.You use a NEXTVAL pseudo column to look at the next possible value that would be generated from a sequence, without actually retrieving the value.
B.You use a CURRVAL pseudo column to look at the current value just generated from a sequence, without affecting the further values to be generated from the sequence.
C.You use a NEXTVAL pseudo column to obtain the next possible value from a sequence by actually retrieving the value from the sequence.
D.You use a CURRVAL pseudo column to generate a value from a sequence that would be used for a specified database column.
E.If a sequence starting from a value 100 and incremented by 1 is used by more than one application, then all of these applications could have a value of 105 assigned to their column whose value is being generated by the sequence.
F.You use a REUSE clause when creating a sequence to restart the sequence once it generates the maximum value defined for the sequence.

10.单项选择题

The EMP table contains these columns:
LAST_NAME VARCHAR2 (25)
SALARY NUMBER (6,2)
DEPARTMENT_ID NUMBER (6)
You need to display the employees who have not been assigned to any department. You write the SELECT statement:
SELECT LAST_NAME, SALARY, DEPARTMENT_ID
FROM EMP
WHERE DEPARTMENT_ID = NULL;
What is true about this SQL statement ?()

 

A.The SQL statement displays the desired results.
B.The column in the WHERE clause should be changed to display the desired results.
C.The operator in the WHERE clause should be changed to display the desired results.
D.The WHERE clause should be changed to use an outer join to display the desired results.