marți, 26 februarie 2013

Section 17 Database Design

LOGICAL COMPARISONS AND PRECEDENCE RULES
Find the clause that will give the same results as:
SELECT *
FROM d_cds
WHERE cd_id NOT IN(90, 91, 92);
WHERE cd_id != 90 and cd_id != 91 and cd_id != 92;
        
Which of the following are examples of logical operators that might be used in a WHERE clause.
AND, OR
NOT
          
What will be the results of the following selection?
SELECT *
FROM employees
WHERE last_name NOT LIKE 'A%' AND last_name NOT LIKE 'B%'
All last names that do not begin with A or B
           
Which of the following statements best describes the rules of precedence when using SQL?
The order in which the expressions are evaluated and calculated
          
Which of the following is earliest in the rules of precedence?
Arithmetic operator
          
Which of the following would be returned by this SQL statement:
SELECT First_name, last_name, department_id
FROM employees
WHERE department_id IN(50,80)
AND first_name LIKE 'C%'
OR last_name LIKE '%s%'
All of the above
          
Which symbol in the WHERE clause means "Not Equal To"?
NOT IN (...)
<>
          

SORTING ROWS
What clause must you place in a SQL statement to have your results sorted from highest to lowest salary?        
ORDER BY salary DESC
          
A column alias can be specified in an ORDER BY Clause. True or False?
True
          
Which of the following is true of the ORDER BY clause:
Must be the last clause of the SQL statement
Defaults to an ascending order (ASC)
          
What columns can be added to the following SELECT statement in its ORDER BY clause? (Choose Three)
SELECT first_name, last_name, salary, hire_date
FROM employees
WHERE department_id = 50
ORDER BY ?????;
last_name, first_name
All columns in the EMPLOYEES table
Any column in the EMPLOYEES table, any expression in the SELECT list or any ALIAS in the SELECT list
          

INTRODUCTION TO FUNCTIONS - SINGLE ROW FUNCTIONS
The following statement represents a multi-row function. True or False?
SELECT MAX(salary)
FROM employees
True
          
The conversion function TO_CHAR is a single row function. True or False?
True
          
The following statement represents a multi-row function. True or False?
SELECT UPPER(last_name)
FROM employees;
False
          
The function COUNT is a single row function. True or False?
False
          
Will the following statement return one row?
SELECT MAX(salary), MIN(Salary), AVG(SALARY)
FROM employees;
Yes, it will return the highest salary, the lowest salary and the average salary from all employees

Niciun comentariu:

Trimiteți un comentariu