Quiz Database Section 2 about Manajemen Basis Data

Quiz Section 2

 tanda(*) itu berarti yang benar



1.Which example would limit the number of rows returned?
                                                                                                                                                                               
SELECT title FROM d_songs WHERE type_code = = 88;
SELECT title FROM d_songs WHEN type_code = = 88;
SELECT title FROM d_songs WHERE type_code = 88; (*)
SELECT title FROM d_songs WHEN type_code = 88;

2.You need to display all the employees whose last names (of any length) start with the letters 'Sm' . Which WHERE clause should you use?
WHERE last_name LIKE 'Sm%' (*)
WHERE last_name LIKE '%Sm'                                                                                    
WHERE last_name LIKE '_Sm'
WHERE last_name LIKE 'Sm_'

3. You need to display all the values in the EMAIL column that contains the underscore (_) character as part of that email address. The WHERE clause in your SELECT statement contains the LIKE operator. What must you include in the LIKE operator?
A percent sign (%)
The ESCAPE option (\)
The ESCAPE option (\) and one or more percent signs (%) (*)
The (+) operator

4. If the EMPLOYEES table has the following columns, and you want to write a SELECT statement to return the employee last name and department number for employee number 176, which of the following SQL statements should you use?
Name                                                                                                         Type Length
EMPLOYEE_ID                                                                                         NUMBER        22
FIRST_NAME                                                                                           VARCHAR2    20
LAST_NAME                                                                                            VARCHAR2    25
EMAIL                                                                                                         VARCHAR2    25
PHONE_NUMBER                                                                                  VARCHAR2    20
SALARY                                                                                                      NUMBER        22
COMMISSION_PCT                                                                               NUMBER        22
MANAGER_ID                                                                                         NUMBER        22
DEPARTMENT_ID                                                                                  NUMBER        22

SELECT last_name, employee_id
FROM employees
WHERE employee_id equals 176;

SELECT first_name, employee_id
FROM employees
WHERE employee_id = 176;

SELECT last_name, department_id
FROM employees
WHERE employee_id equals 176;                                                                             

SELECT last_name, department_id
FROM employees
WHERE employee_id = 176; (*)

5. What will be the result of the SELECT statement and what will display?
SELECT last_name, salary, salary + 300
FROM employees;

Display the last name, salary, and the results of adding 300 to each salary for all the employees (*)
Display the last name, salary, and the results of adding 300 to the salary of the first employee row
Modify the salary column by adding 300 and only display the last name and the new salary.
Display the last name and salary of all employees who have a salary greater than 300.

6. Which two statements would select salaries that are greater than or equal to 2500 and less than or equal to 3500? (Choose two)
(Choose all correct answers)                                                                                                      

WHERE salary >= 2500 AND salary <= 3500 (*)
WHERE salary BETWEEN 2500 AND 3500 (*)
WHERE salary <=2500 AND salary >= 3500
WHERE salary BETWEEN 3500 AND 2500

7. Which of the following are examples of comparison operators used in the WHERE clause?

=, >, <, <=, >=, <>
between ___ and ___
in (..,..,.. )
like
is null
All of the above (*)

8.When using the "LIKE" operator, the % and _ symbols can be used to do a pattern-matching, wild card search. True or False?
True (*)
False

9. The EMPLOYEES table contains these columns:
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
EMAIL VARCHAR2(50)

10.You are writing a SELECT statement to retrieve the names of employees that have an email address.

SELECT last_name||', '||first_name "Employee Name"
FROM employees;

Which WHERE clause should you use to complete this statement?

WHERE email != NULL;
WHERE email IS NULL;
WHERE email IS NOT NULL; (*)
WHERE email = NULL;

11.Which of the following WHERE clauses would not select the number 10?
                                                                                                                     
WHERE hours <>10 (*)
WHERE hours BETWEEN 10 AND 20
WHERE hours IN (8,9,10)
WHERE hours <= 10

12. Which of the following elements cannot be included in a WHERE clause?       

A constant
A comparison condition
A column name
A column alias (*)

13. Which clause would you include in a SELECT statement to restrict the data returned to only the employees in department 10?
IS
FROM
SELECT
WHERE (*)

14. You need to display employees with salaries that are at least 30000 or higher. Which comparison operator should you use?

> 
!=
>= (*)
"=>"

15.The structure of the table can be displayed with the _________ command:

Desc and the Describe (*)
Desc
Dis
Describe

16. The following is a valid SQL SELECT statement. True or False?
SELECT first_name || ' ' || last_name alias AS Employee_Name
FROM employees:

True

False (*)

0 Comments

Silahkan berkomentar
EmoticonEmoticon