Database Programming With SQL Mid Semester 1
Database Programming With SQL Mid Semester 1
Section 1
(Answer all questions in this section)
True
False (*)
Correct Correct.
INSERT (*)
NEW
CREATE
ADD
Correct Correct.
A blank space
Correct Correct
SELECT (*)
FROM
WHERE
Any of the above options; you can list columns wherever you want to
in a SELECT statement.
Correct Correct.
Table (*)
Row
Key
Field
Correct Correct
(Answer all questions in this section)
True
False (*)
Correct Correct.
Correct Correct
Correct Correct.
9. Which of the following are true? (Choose Two) Mark for Review
(1) Points
Correct Correct
10. 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
ISNULL
"= NULL"
NULL!
IS NULL (*)
Correct Correct.
(Answer all questions in this section)
11. The structure of the table can be displayed with the _________
command: Mark for Review
(1) Points
Describe
Desc
Dis
Section 3
(Answer all questions in this section)
The OR and AND conditions have the same precedence and will be
evaluated from right to left
Correct Correct.
14. Which of the following are TRUE regarding the logical AND
operator? Mark for Review
(1) Points
Correct Correct.
True
False (*)
Correct Correct
(Answer all questions in this section)
46
45.9
50 (*)
Correct Correct
17. Which query would return a whole number if the sysdate is 26-
May-2004? Mark for Review
(1) Points
SELECT TRUNC(MONTHS_BETWEEN(SYSDATE,'19-Mar-1979')
/12)
AS YEARS
FROM DUAL;
(*)
Correct Correct
18. The PRICE table contains this data:
PRODUCT_ID MANUFACTURER_ID
86950 59604
You query the database and return the value 95. Which script did you
use?
SELECT SUBSTR(product_id, 3, 2)
FROM price
WHERE manufacturer_id = 59604;
(*)
SELECT LENGTH(product_id, 3, 2)
FROM price
WHERE manufacturer_id = 59604;
Correct Correct
Correct Correct
Section 5
(Answer all questions in this section)
CASE (*)
DESCRIBE
WHERE
NULLIF
Correct Correct
Correct Correct
22. Which statement concerning single row functions is true? Mark
for Review
(1) Points
Single row functions can accept only one argument, but can return
multiple values.
Correct Correct
SELECT *
FROM employees
WHERE employee_id = manager_id; Mark for Review
(1) Points
Yes, Oracle will perform implicit dataype conversion, and the query
will return one row of data.
No.ᅠ You will have to re-wirte the statement and perform explicit
datatype conversion.
Yes, Oracle will perform implicit datatype conversion, but the WHERE
clause will not find any matching data. (*)
Correct Correct
NVL2
NULLIF (*)
NULL
NVL
Correct Correct
King, -1
Kochhar, 100
Vargas, 124
Zlotkey, .2
King, -1
Kochhar, -1
Vargas, -1
Zlotkey, .2
King, -1
Kochhar, -1
Vargas, -1
Zlotkey, 100
(*)
Correct Correct
(Answer all questions in this section)
26. Which type of join returns rows from one table that have NO
direct match in the other table? Mark for Review
(1) Points
Equijoin
Self join
Natural join
Correct Correct
27. You need to display all the rows (both matching and non-
matching) from both the EMPLOYEE and EMPLOYEE_HIST tables.
Which type of join would you use? Mark for Review
(1) Points
An inner join
Correct Correct
True (*)
False
Correct Correct
Correct Correct
Correct Correct
Section 6
(Answer all questions in this section)
31. Which statement about a natural join is true? Mark for Review
(1) Points
Columns with the same names must have identical data types.
Columns with the same names must have the same precision and
datatype. (*)
Columns with the same names cannot be included in the SELECT list
of the query.
Columns with the same names must have compatible data types.
Correct Correct
If the columns having the same names have different data types, then
an error is returned. (*)
When you attempt to write it as an equijoin.
If it selects rows from the two tables that have equal values in all
matched columns.
When the NATURAL JOIN clause is based on all columns in the two
tables that have the same name.
Correct Correct
Section 7
(Answer all questions in this section)
Which SELECT statement will return the customer ID, the company
and the total sales?
Correct Correct
Correct Correct
35. Using Oracle Proprietary join syntax, which two operators can be
used in an outer join condition using the outer join operator (+)? Mark
for Review
(1) Points
OR and =
BETWEEN...AND... and IN
IN and =
Correct Correct
Section 8
(Answer all questions in this section)
Which SELECT statement will return the average price for the 4x4
model?
SELECT AVG(price)
FROM trucks
WHERE model IS '4x4';
SELECT AVG(price)
FROM trucks
WHERE model = '4x4';
(*)
SELECT AVG(price)
FROM trucks
WHERE model IS 4x4;
Correct Correct
37. Which group function would you use to display the average price
of all products in the PRODUCTS table? Mark for Review
(1) Points
MAX
SUM
AVG (*)
COUNT
Correct Correct
38. Group functions can avoid computations involving duplicate
values by including which keyword? Mark for Review
(1) Points
NULL
SELECT
DISTINCT (*)
UNLIKE
Correct Correct
Section 9
(Answer all questions in this section)
SELECT
GROUP BY (*)
WHERE
FROM
Correct Correct
TEAMS
TEAM_ID NUMBER NOT NULL, PRIMARY KEY
TEAM_NAME VARCHAR2 (25)
You need to create a report that lists the names of each team with
more than three goal keepers.
Which SELECT statement will produce the desired result?
Yes, because Oracle will correct any mistakes in the statement itself
No, beause you cannot have a WHERE-clause when you use group
functions.
Yes
Correct Correct
Correct Correct
43. If you want to include subtotals and grand totals for all columns
mentioned in a GROUP BY clause, you should use which of the
following extensions to the GROUP BY clause? Mark for Review
(1) Points
ROLLUP
HAVING
CUBE (*)
Correct Correct
44. INTERSECT will give you the common rows found in both
queries. (True or False?) Mark for Review
(1) Points
True (*)
False
Correct Correct
Section 10
(Answer all questions in this section)
True (*)
False
Section 10
(Answer all questions in this section)
46. Single row subqueries may not include this operator: Mark for
Review
(1) Points
ALL (*)
>
<>
Correct Correct
DEPART_HIST:
EMPLOYEE_ID NUMBER(9)
OLD_DEPT_ID NUMBER(9)
NEW_DEPT_ID NUMBER(9)
CHANGE_DATE DATE
Correct Correct
49. Which of the following best describes the meaning of the ANY
operator? Mark for Review
(1) Points
Only one
Two or more
None