Quiz
Oracle ComeBack
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (18)
1Which two statements about the evaluation of clauses in a SELECT statement are true?
(Choose two.)- AThe Oracle Server will evaluate an ORDER BY clause before a WHERE clause.
- BThe Oracle Server will evaluate a GROUP BY clause before a HAVING clause.
- CThe Oracle Server will evaluate a WHERE clause before a GROUP BY clause.
- DThe Oracle Server will evaluate an ORDER BY clause before a HAVING clause.
- EThe Oracle Server will evaluate a HAVING clause before a WHERE clause.
2What value is returned after executing the following statement? Take note that 01-JAN-2009 occurs on a Thursday.
SELECT NEXT_DAY('01-JAN-2009','wed') FROM DUAL;- AWednesday
- B31-JAN-2009
- CNone of the above
- D07-JAN-2009
3Which SQL statement will query the EMPLOYEES table for FIRST_NAME, LAST_NAME, and SALARY of all employees in DEPARTMENT_ID 40 in the alphabetical order of last name?
- ASELECT first_name, last_name, salary FROM TABLE employees WHERE department_id IS 40 ORDER BY last_name ASC;
- BSELECT first_name last_name salary FROM employees WHERE department_id = 40 ORDER BY last_name ASC;
- CSELECT first_name last_name salary FROM employees ORDER BY last_name WHERE department_id = 40;
- DSELECT first_name, last_name, salary FROM employees WHERE department_id = 40 ORDER BY last_name;
- ESELECT first_name, last_name, salary FROM employees ORDER BY last_name ASC WHERE department_id = 40;
4Which three statements/commands would cause a transaction to end?
(Choose three.)- AROLLBACK
- BCREATE
- CSELECT
- DCOMMIT
- ESAVEPOINT
5Which statements are true regarding the WHERE and HAVING clauses in a SELECT statement?
(Choose all that apply.)- AThe HAVING clause can be used with aggregate functions in subqueries.
- BThe aggregate functions and columns used in the HAVING clause must be specified in the SELECT list of the query.
- CThe WHERE clause can be used to exclude rows before dividing them into groups.
- DThe WHERE clause can be used to exclude rows after dividing them into groups.
- EThe WHERE and HAVING clauses can be used in the same statement only if they are applied to different columns in the table.
6SQL is a set-oriented language. Which of these features is a consequence of this?
(Choose the best answer.)- AIndividual rows must have a unique identifier.
- BOne statement can affect multiple rows.
- CSQL statements can be placed within blocks of code in other languages, such as Java and PL/SQL.
- DSets of users can be managed in groups.
7What is true of using group functions on columns that contain NULL values?
- AGroup functions on columns cannot be accurately used on columns that contain NULL values.
- BGroup functions on columns ignore NULL values.
- CGroup functions on columns returning dates include NULL values.
- DGroup functions on columns include NULL values in calculations if you use the keyword INC_NULLS.
- EGroup functions on columns returning numbers include NULL values.
8Which actions are allowed on a table that is marked as read-only?
- ADropping a table
- BTruncating a table
- CInserting new data
- DDropping a constraint
- EDropping an index
9Which of the following statements will create a primary key for the CITY table with the columns STATE_CD and CITY_CD?
- ACREATE CONSTRAINT PK_CITY PRIMARY KEY ON CITY (STATE_CD, CITY_CD);
- BALTER TABLE CITY ADD CONSTRAINT PK_CITY PRIMARY KEY (STATE_CD, CITY_CD);
- CALTER TABLE CITY ADD PRIMARY KEY (STATE_CD, CITY_CD);
- DALTER TABLE CITY ADD PRIMARY KEY CONSTRAINT PK_CITY ON (STATE_CD, CITY_CD);
- ECREATE PRIMARY KEY ON CITY (STATE_CD, CITY_CD);
10You want to display 5 percent of the rows from the sales table for products with the lowest AMOUNT_SOLD and also want to include the rows that have the same AMOUNT_SOLD even if this causes the output to exceed 5 percent of the rows.
Which query will provide the required result?- ASELECT prod_id, cust_id, amount_sold
FROM sales
ORDER BY amount_sold
FETCH FIRST 5 PERCENT ROWS ONLY; - BSELECT prod_id, cust_id, amount_sold
FROM sales
ORDER BY amount_sold
FETCH FIRST 5 PERCENT ROWS WITH TIES ONLY; - CSELECT prod_id, cust_id, amount_sold
FROM sales
ORDER BY amount_sold
FETCH FIRST 5 PERCENT ROWS ONLY WITH TIES; - DSELECT prod_id, cust_id, amount_sold
FROM sales
ORDER BY amount_sold
FETCH FIRST 5 PERCENT ROWS WITH TIES;
- ASELECT prod_id, cust_id, amount_sold
11Consider this statement:
SELECT last_name, (SELECT count(*) FROM departments) FROM employees WHERE salary = (SELECT salary FROM employees);
What is wrong with it?
(Choose the best answer.)- AThe statement will fail if the second query returns more than one row.
- BNothing is wrong—the statement should run without error.
- CThe statement will run but is extremely inefficient because of the need to run the second subquery once for every row in EMPLOYEES.
- DThe statement will fail because the subquery in the SELECT list references a table that is not listed in the FROM clause.
12Which two functions could you use to strip leading characters from a character string?
- AINSTR
- BSUBSTR
- CLTRIM
- DSTRIP
- ERTRIM
13If you issue this command:
UPDATE employees SET salary=salary * 1.1;
what will be the result?
(Choose the best answer.)- AThe statement will fail because there is no WHERE clause to restrict the rows affected.
- BThe first row in the table will be updated.
- CThere will be an error if any row has its SALARY column NULL.
- DEvery row will have SALARY incremented by 10 percent, unless SALARY was NULL.
14Examine the structure of the products table:
CREATE TABLE products(
PRO_ID NUMBER(4) NOT NULL,
PROD_NAME VARCHAR2(20),
PROD_STATUS VARCHAR2(6),
QTY_IN_HAND NUMBER(8,2),
UNIT_PRICE NUMBER(10,2)
);
You want to display the names of the products that have the highest total value for UNIT_PRICE * QTY_IN_HAND. Which SQL statement gives the required output?- ASELECT prod_name
FROM products
WHERE (unit_price * qty_in_hand) = (SELECT MAX(unit_price * qty_in_hand)
FROM products); - BSELECT prod_name
FROM products
WHERE (unit_price * qty_in_hand) = (SELECT MAX(unit_price * qty_in_hand)
FROM products
GROUP BY prod_name); - CSELECT prod_name
FROM products
GROUP BY prod_name
HAVING MAX (unit_price * qty_in_hand) = (SELECT MAX(unit_price * qty_in_hand)
FROM products)
GROUP BY prod_name; - DSELECT prod_name
FROM products
- ASELECT prod_name
15Which tasks can be performed using SQL functions that are built into Oracle database?
(Choose three.)- Aremoving trailing, leading, and embedded characters from a character string
- Bcomparing two expressions to check whether they are equal
- Cadding a number to a date for a resultant date value
- Dchecking whether a specified character exists in a given string
- Efinding the remainder of a division
16Examine the structure of the PROMOS table:
CREATE TABLE promos(
PROMO_ID NUMBER(3) NOT NULL,
PROMO_NAME VARCHAR2(30),
PROMO_START_DATE DATE NOT NULL,
PROMO_END_DATE DATE NOT NULL
);
You want to display the list of promo names with the message ‘Same Day’ for promos that started and ended on the same day. Which query gives the correct output?- ASELECT promo_name,
NVL2(TO_CHAR(TRUNC(promo_end_date-promo_start_date)), NULL, 'Same Day')
FROM promos; - BSELECT promo_name,
DECODE((NULLIF(promo_start_date, promo_end_date)), NULL, 'Same Day')
FROM promos; - CSELECT promo_name, NVL(TRUNC(promo_end_date - promo_start_date), 'Same Day'
FROM promos; - DSELECT promo_name, NVL(NULLIF(promo_start_date, promo_end_date), 'Same Day')
FROM promos;
- ASELECT promo_name,
17Which two statements about sub queries are true?
(Choose two.)- AA sub query should retrieve only one row.
- BWhen a sub query is used with an inequality comparison operator in the outer SQL statement, the column list in the SELECT clause of the sub query should contain only one column.
- CSub queries CANNOT be nested by more than two levels.
- DA sub query can be used only in SQL query statements.
- EA sub query can retrieve zero or more rows.
- FA sub query CANNOT be used in an SQL query statement that uses group functions.
18In which three situations does a transaction complete?
- AWhen a ROLLBACK command is executed
- BWhen a data definition language (DDL) statement is executed
- CWhen a DELETE statement is executed
- DWhen a TRUNCATE statement is executed after the pending transaction
- EWhen a PL/SQL anonymous block is executed
Information
- Description
- Quiz on Oracle ComeBack, created by Brandon Gagon on 17/04/2019.
- Author
- Brandon Gagon
- Language
- English
- Views
- 7
- Rating
- No ratings yet Rate this quiz