单项选择题

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.


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题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';

2.多项选择题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));

3.单项选择题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));

4.单项选择题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);

5.单项选择题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

6.单项选择题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.

7.多项选择题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.

8.单项选择题

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.

9.单项选择题

Click the Exhibit button to examine the structures of the EMPLOYEES, DEPARTMENTS, and TAX tables.
For which situation would you use a nonequijoin query?()

A.to find the tax percentage for each of the employees
B.to list the name, job_id, and manager name for all the employees
C.to find the name, salary, and the department name of employees who are not working with Smith
D.to find the number of employees working for the Administrative department and earning less than 4000
E.to display name, salary, manager ID, and department name of all the employees, even if the employees do not have a department ID assigned

10.单项选择题

Examine the description of the CUSTOMERS table:
CUSTOMER_ID NUMBER(4) NOT NULL
CUSTOMER_NAME VARCHAR2(100) NOT NULL
STREET_ADDRESS VARCHAR2(150)
CITY_ADDRESS VARCHAR2(50)
STATE_ADDRESS VARCHAR2(50)
PROVINCE_ADDRESS VARCHAR2(50)
COUNTRY_ADDRESS VARCHAR2(50)
POSTAL_CODE VARCHAR2(12)
CUSTOMER_PHONE VARCHAR2(20)
The CUSTOMER_ID column is the primary key for the table.
Which statement returns the city address and the number of customers in the cities Los Angeles or San Francisco?()
 

A.SELECT city_address, COUNT(*) FROM customers WHERE city_address IN ('Los Angeles', 'San Francisco');
B.SELECT city_address, COUNT(*) FROM customers WHERE city_address IN ('Los Angeles', 'San Francisco') GROUP BY city_address;
C.SELECT city_address, COUNT(customer_id) FROM customers WHERE city_address IN ('Los Angeles', 'San Francisco') GROUP BY city_address, customer_id;
D.SELECT city_address, COUNT(customer_id) FROM customers GROUP BY city_address IN ('Los Angeles', 'San Francisco');

最新试题

Which four are types of functions available in SQL? ()

题型:多项选择题

Which object privileges can be granted on a view? ()

题型:单项选择题

You need to design a student registration database that contains several tables storing academic information.The STUDENTS table stores information about a student. The STUDENT_GRADES table storesinformation about the student's grades. Both of the tables have a column named STUDENT_ID. The STUDENT_ID column in the STUDENTS table is a primary key.You need to create a foreign key on the STUDENT_ID column of the STUDENT_GRADES table thatpoints to the STUDENT_ID column of the STUDENTS table. Which statement creates the foreign key?()

题型:单项选择题

Which is an iSQL*Plus command? ()

题型:单项选择题

For which action can you use the TO_DATE function? ()

题型:单项选择题

Evaluate the SQL statement: TRUNCATE TABLE DEPT; Which three are true about the SQL statement? ()

题型:多项选择题

The user Alice wants to grant all users query privileges on her DEPT table. Which SQL statement accomplishes this? ()

题型:单项选择题

Which two statements are true about constraints? ()

题型:多项选择题

Examine the structure of the STUDENTS table:STUDENT_ID NUMBER NOT NULL, Primary KeySTUDENT_NAME VARCHAR2(30)COURSE_ID VARCHAR2(10) NOT NULLMARKS NUMBERSTART_DATE DATEFINISH_DATE DATEYou need to create a report of the 10 students who achieved the highest ranking in the course INT SQL and who completed the course in the year 1999.Which SQL statement accomplishes this task? ()

题型:单项选择题

Which one is a system privilege? ()

题型:单项选择题