Test:
Quiz: Working with Columns, Characters, and Rows
1. Which
of the following is NOT BEING DONE in this SQL statement?
SELECT
first_name || ‘ ‘ || last_name “Name”
FROM employees;
FROM employees;
Concatenating
first name, middle name and last name
Putting a space between first name and last name
Selecting columns from the employees table
Using a column alias
Putting a space between first name and last name
Selecting columns from the employees table
Using a column alias
2. The
concatenation operator …
Brings
together columns or character strings into other columns
Creates a resultant column that is a character expression
Is represented by two vertical bars ( || )
All of the above
Creates a resultant column that is a character expression
Is represented by two vertical bars ( || )
All of the above
3. The
following is a valid SQL SELECT statement. True or False?
SELECT
first_name || ‘ ‘ || last_name alias AS Employee_Name
FROM employees:
FROM employees:
True
False
False
4. The
structure of the table can be displayed with the _________ command:
Desc
Describe
Dis
A and B
Describe
Dis
A and B
5. In
order to eliminate duplicate rows use the ________ keyword
FIRST_ONLY
DISTINCT
SINGLES_ONLY
EXCLUSIVE
DISTINCT
SINGLES_ONLY
EXCLUSIVE
Test:
Quiz: Limit Rows Selected
1. Which
of the following statements will work?
SELECT
first_name ||’ ‘||last_name NAME, department_id DEPARTMENT, salary*12 “ANNUAL
SALARY”
FROM employees
WHERE name = ‘King’;
SELECT first_name ||’ ‘||last_name NAME, department_id DEPARTMENT, salary*12 “ANNUAL SALARY”
FROM employees
WHERE last_name = ‘King’;
SELECT first_name ||’ ‘||last_name NAME, department_id DEPARTMENT, salary*12 ‘ANNUAL SALARY’
FROM employees
WHERE last_name = ‘King’;
SELECT first_name ||’ ‘||last_name NAME, department_id DEPARTMENT, salary*12 ‘ANNUAL SALARY’
FROM employees
WHERE name = ‘King’;
FROM employees
WHERE name = ‘King’;
SELECT first_name ||’ ‘||last_name NAME, department_id DEPARTMENT, salary*12 “ANNUAL SALARY”
FROM employees
WHERE last_name = ‘King’;
SELECT first_name ||’ ‘||last_name NAME, department_id DEPARTMENT, salary*12 ‘ANNUAL SALARY’
FROM employees
WHERE last_name = ‘King’;
SELECT first_name ||’ ‘||last_name NAME, department_id DEPARTMENT, salary*12 ‘ANNUAL SALARY’
FROM employees
WHERE name = ‘King’;
2. How
can you write not equal to in the WHERE-clause
!=
^=
<>
All of the above
^=
<>
All of the above
3. To
restrict the rows returned from an SQL Query, you should use the _____ clause:
SELECT
WHERE
GROUP BY
CONDITION
All of the above
WHERE
GROUP BY
CONDITION
All of the above
4. Which
of the following are true? (Choose Two)
Character
strings are enclosed in double quotation marks
Date values are enclosed in single quotation marks
Character values are not case-sensitive
Date values are format-sensitive
Date values are enclosed in single quotation marks
Character values are not case-sensitive
Date values are format-sensitive
5. Which
example would limit the number of rows returned?
SELECT
title FROM d_songs WHEN type_code = 88;
SELECT title FROM d_songs WHERE type_code = = 88;
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 WHERE type_code = 88;
SELECT title FROM d_songs WHEN type_code = = 88;
6. Which
query would give the following result?
LAST_NAME
FIRST_NAME DEPARTMENT_ID
King Steven 90
King Steven 90
SELECT
last_name, first_name, department_id
FROM employees C
WHERE last_name = ‘KING’;
SELECT last_name, first_name, department_id
FROM employees
WHERE last_name = ‘King’;
SELECT last_name, first_name, department_id
FROM employees
WHERE last_name LIKE ‘k%’;
SELECT last_name, first_name, department_id
FROM employees
WHERE last_name LIKE ‘KING’;
FROM employees C
WHERE last_name = ‘KING’;
SELECT last_name, first_name, department_id
FROM employees
WHERE last_name = ‘King’;
SELECT last_name, first_name, department_id
FROM employees
WHERE last_name LIKE ‘k%’;
SELECT last_name, first_name, department_id
FROM employees
WHERE last_name LIKE ‘KING’;
7. Which
of the following would be returned by this SELECT statement:
SELECT
last_name, salary
FROM employees
WHERE salary < 3500;
FROM employees
WHERE salary < 3500;
LAST_NAME
SALARY
King 5000
LAST_NAME SALARY
Rajas 3500
LAST_NAME SALARY
Davies 3100
All of the above
King 5000
LAST_NAME SALARY
Rajas 3500
LAST_NAME SALARY
Davies 3100
All of the above
Test:
Quiz: Comparison Operators
1. Which
statement would select salaries that are greater than or equal to 2500 and less
than or equal to 3500? Choose two correct answers.
WHERE
salary >= 2500 AND salary <= 3500
WHERE salary <=2500 AND salary >= 3500
WHERE salary BETWEEN 2500 AND 3500
WHERE salary BETWEEN 3500 AND 2500
WHERE salary <=2500 AND salary >= 3500
WHERE salary BETWEEN 2500 AND 3500
WHERE salary BETWEEN 3500 AND 2500
2. Which
of the following are examples of comparison operators used in the WHERE clause?
=, >,
<, <=, >=, <>
between ___ and ___
in (..,..,.. )
like
is null
All of the above
between ___ and ___
in (..,..,.. )
like
is null
All of the above
3. Which
of the following WHERE clauses would not select the number 10?
WHERE
hours BETWEEN 10 AND 20
WHERE hours <= 10
WHERE hours <>10
WHERE hours IN (8,9,10)
WHERE hours <= 10
WHERE hours <>10
WHERE hours IN (8,9,10)
4. When
using the “LIKE” operator, the % and _ symbols can be used to do a
pattern-matching, wild card search. True or False?
True
False
False
No comments:
Post a Comment