joi, 4 octombrie 2018

dabase programming section 2

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


True (*)


False

Which of the following WHERE clauses would not select the number 10? Mark for Review
(1) Points


WHERE hours <>10 (*)


WHERE hours BETWEEN 10 AND 20


WHERE hours IN (8,9,10)


WHERE hours <= 10

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

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?

 Mark for Review
(1) Points


WHERE email IS NOT NULL; (*)


WHERE email = NULL;


WHERE email != NULL;


WHERE email IS NULL;

The EMPLOYEES table includes these columns:
EMPLOYEE_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(15) NOT NULL
FIRST_NAME VARCHAR2(10) NOT NULL
HIRE_DATE DATE NOT NULL

You want to produce a report that provides the last names, first names, and hire dates of those employees who were hired between March 1, 2000, and August 30, 2000. Which statements can you issue to accomplish this task?

 Mark for Review
(1) Points


SELECT last_name, first_name, hire_date
FROM employees
WHERE hire_date BETWEEN '01-Mar-2000' AND '30-Aug-2000';
(*)



SELECT last_name, first_name, hire_date
FROM employees
WHERE hire_date BETWEEN '30-Aug-2000' AND '01-Mar-2000';


SELECT last_name, first_name, hire_date
FROM employees
AND hire_date >= '01-Mar-2000' and hire_date <= '30-Aug-2000';


SELECT last_name, first_name, hire_date
FROM employees
GROUP BY hire_date >= '01-Mar-2000' and hire_date <= '30- Aug-2000';


Which of the following are examples of comparison operators used in the WHERE clause? Mark for Review
(1) Points


=, >, <, <=, >=, <>


between ___ and ___


in (..,..,.. )


like


is null


All of the above (*)


Which SELECT statement will display both unique and non-unique combinations of the MANAGER_ID and DEPARTMENT_ID values from the EMPLOYEES table? Mark for Review 
(1) Points
SELECT manager_id, DISTINCT department_id FROM employees;

SELECT manager_id, department_id DISTINCT FROM employees;

SELECT DISTINCT manager_id, department_id FROM employees;

SELECT manager_id, department_id FROM employees; (*)


Which of the following commands will display the last name concatenated with the job ID from the employees table, separated by a comma and space, and label the resulting column "Employee and Title"? Mark for Review 
(1) Points
SELECT last_name||","|| job_id "Employee and Title" FROM employees;

SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM emp;

SELECT last_name||', '|| job_id "Employee and Title" FROM employees; (*)

SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM employees;



Evaluate this SELECT statement:
SELECT * 
FROM employees
WHERE department_id IN(10, 20, 30) 
AND salary > 20000;

Which values would cause the logical condition to return TRUE?

 Mark for Review 
(1) Points
DEPARTMENT_ID = 10 and SALARY = 20000

DEPARTMENT_ID = null and SALARY = 20001

DEPARTMENT_ID = 20 and SALARY = 20000

DEPARTMENT_ID = 10 and SALARY = 20001 (*)


Evaluate this SELECT statement:
SELECT last_name, first_name, salary 
FROM employees;

How will the heading for the FIRST_NAME column appear in the display by default in Oracle Application Express?

 Mark for Review 
(1) Points
The heading will display with the first character capitalized and centered.

The heading will display with the first character capitalized and left justified.

The heading will display as uppercase and left justified.

The heading will display as uppercase and centered. (*)


You want to determine the orders that have been placed by customers who reside in the city of Chicago. You write this partial SELECT statement:
SELECT orderid, orderdate, total 
FROM orders;

What should you include in your SELECT statement to achieve the desired results?

 Mark for Review 
(1) Points
AND city = 'Chicago';

WHERE city = 'Chicago'; (*)

AND city = Chicago;

WHERE city = Chicago;


You need to display all the rows in the EMPLOYEES table that contain a null value in the DEPARTMENT_ID column. Which comparison operator should you use? Mark for Review 
(1) Points
IS NULL (*)

NULL!

ISNULL

"= NULL"



Which comparison operator searches for a specified character pattern? Mark for Review 
(1) Points
BETWEEN...AND...

IN

IS NULL

LIKE (*)


When using the LIKE condition, which symbol represents any sequence of characters of any length--zero, one, or more characters? Mark for Review 
(1) Points
#
_

&

% (*)



The Concatenation Operator does which of the following? Mark for Review 
(1) Points
Links rows of data together inside the database.

Separates columns.

Is represented by the asterisk (*) symbol

Links two or more columns or literals to form a single output column (*)



  When using the LIKE condition to search for _ symbols, which character can you use as the default ESCAPE option? Mark for Review 
(1) Points
&

%

\ (*)

^


Which symbol represents the not equal to condition? Mark for Review 
(1) Points
~

!= (*)

#



The structure of the table can be displayed with the _________ command: Mark for Review 
(1) Points
Desc and the Describe (*)

Dis

Desc

Describe



Which of the following is NOT BEING DONE in this SQL statement?
SELECT first_name || ' ' || last_name "Name" 
FROM employees;

 Mark for Review 
(1) Points
Concatenating first name, middle name and last name (*)

Selecting columns from the employees table

Using a column alias

Putting a space between first name and last name


Which comparison condition would you use to select rows that match a character pattern? Mark for Review 
(1) Points
SIMILAR

IN

LIKE (*)

ALMOST



You need to display only unique combinations of the LAST_NAME and MANAGER_ID columns in the EMPLOYEES table. Which keyword should you include in the SELECT clause? Mark for Review 
(1) Points
ONLY

DISTINCT (*)

DISTINCTROW

UNIQUEONE





Which two statements would select salaries that are greater than or equal to 2500 and less than or equal to 3500? (Choose two) Mark for Review 
(1) Points
(Choose all correct answers)
WHERE salary BETWEEN 2500 AND 3500 (*)

WHERE salary BETWEEN 3500 AND 2500

WHERE salary <=2500 AND salary >= 3500

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


If you write queries using the BETWEEN operator, it does not matter in what order you enter the values, i.e. BETWEEN low value AND high value will give the same result as BETWEEN high value and low value. True or False? Mark for Review 
(1) Points
True

False (*)



Which of the following is true? Mark for Review 
(1) Points
Date values are enclosed in single quotation marks (*)

Date values are not format-sensitive

Character strings must be enclosed in double quotation marks

Character values are not case-sensitive



Which of the following statements will work? Mark for Review 
(1) Points
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';

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';
(*)



You want to retrieve a list of customers whose last names begin with the letters 'Fr' . Which keyword should you include in the WHERE clause of your SELECT statement to achieve the desired result? Mark for Review 
(1) Points
AND

LIKE (*)

BETWEEN

IN


Which of the following would be returned by this SELECT statement:
SELECT last_name, salary 
FROM employees 
WHERE salary < 3500;

 Mark for Review 
(1) Points
LAST_NAME SALARY
King 5000

LAST_NAME SALARY
Rajas 3500

LAST_NAME SALARY
Davies 3100
(*)


All of the above






You need to display employees whose salary is in the range of 10000 through 25000 for employees in department 50 . What does the WHERE clause look like? Mark for Review 
(1) Points
WHERE department_id > 50 
AND salary BETWEEN 10000 AND 25000 

WHERE department_id < 50 
AND salary BETWEEN 10000 AND 25000

WHERE department_id = 50 
AND salary BETWEEN 25001 AND 10001 

WHERE department_id = 50 
AND salary BETWEEN 10000 AND 25000 
(*)



Where in a SQL statement can you not use arithmetic operators? Mark for Review 
(1) Points
NONE

FROM (*)

WHERE

SELECT


You need to combine the FIRST_NAME and LAST_NAME columns in the EMPLOYEES table and display the columns as a combined character string. Which operator should you use? Mark for Review 
(1) Points
+

|

|| (*)

AND



Which operator is used to combine columns of character strings to other columns? Mark for Review 
(1) Points
/

*

+

|| (*)




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
 Mark for Review 
(1) Points
SELECT last_name, employee_id 
FROM employees 
WHERE employee_id equals 176;

SELECT last_name, department_id 
FROM employees 
WHERE employee_id equals 176;

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


SELECT first_name, employee_id 
FROM employees 
WHERE employee_id = 176;




You need write a SELECT statement that should only return rows that contain 34, 46, or 48 for the DEPARTMENT_ID column. Which operator should you use in the WHERE clause to compare the DEPARTMENT_ID column to this specific list of values? Mark for Review 
(1) Points
!=

=

BETWEEN..AND..

IN (*)


Which example would limit the number of rows returned? Mark for Review 
(1) Points
SELECT title FROM d_songs WHERE type_code = = 88;

SELECT title FROM d_songs WHEN type_code = = 88;

SELECT title FROM d_songs WHEN type_code = 88;

SELECT title FROM d_songs WHERE type_code = 88; (*)


You need to display all the employees whose last names (of any length) start with the letters 'Sm' . Which WHERE clause should you use? Mark for Review 
(1) Points
WHERE last_name LIKE '_Sm'

WHERE last_name LIKE '%Sm'

WHERE last_name LIKE 'Sm_'

WHERE last_name LIKE 'Sm%'(*)



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? Mark for Review 
(1) Points
A percent sign (%)

The ESCAPE option (\) and one or more percent signs (%)(*)

The (+) operator

The ESCAPE option (\)



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

 Mark for Review 
(1) Points
Display the last name and salary of all employees who have a salary greater than 300.

Display the last name, salary, and the results of adding 300 to the salary of the first employee row

Display the last name, salary, and the results of adding 300 to each salary for all the employees (*)

Modify the salary column by adding 300 and only display the last name and the new salary.



The concatenation operator ... Mark for Review 
(1) Points
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 (*)



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

 Mark for Review 
(1) Points
True

False (*)




Niciun comentariu:

Trimiteți un comentariu