Quiz
Midterm 2 (Chapter 5 - 13)
Crie uma conta grátis para terminar este quiz
Salve seu progresso e veja sua nota final.
Já tem uma conta? Inicie sessão
Perguntas do quiz (180)
1Which of the following is a correct statement?
- AA commit is issued implicitly when a user exits SQL Developer or SQL*Plus.
- BA commit is issued implicitly when a DDL command is executed.
- CA commit is issued automatically when a DML command is executed.
- DAll of the above are correct.
- EA commit is issued implicitly when a user exits SQL Developer or SQL*Plus, and when a DDL command is executed.
- FA commit is issued implicitly when a user exits SQL Developer or SQL*Plus. A commit is issued automatically when a DML command is executed.
2Which of the following is a valid SQL statement?
- ASELECT * WHERE amid = ‘J100’ FOR UPDATE;
- BINSERT INTO homework10 VALUES (SELECT * FROM acctmanager);
- CDELETE amid FROM acctmanager;
- Drollback;
- Eall of the above
3Which of the following commands can be used to add rows to a table?
- AINSERT INTO
- BALTER TABLE ADD
- CUPDATE
- DSELECT . . . FOR UPDATE
4Which of the following statements deletes all rows in the HOMEWORK10 table?
- ADELETE * FROM homework10;
- BDELETE *.* FROM homework10;
- CDELETE FROM homework10;
- DDELETE FROM homework10 WHERE amid = ‘*’;
- EBoth (DELETE FROM homework10;) and (DELETE FROM homework10 WHERE amid = ‘*’;) delete all rows in the HOMEWORK10 table.
5Which of the following statements places a shared lock on at least a portion of a table named
HOMEWORK10?- ASELECT * FROM homework10 WHERE col2 IS NULL FOR UPDATE;
- BINSERT INTO homework10 (col1, col2, col3) VALUES (‘A’, ‘B’, ‘C’);
- CUPDATE homework10 SET col3 = NULL WHERE col1 = ‘A’;
- DUPDATE homework10 SET col3 = LOWER (col3) WHERE col1 = ‘A’;
- Eall of the above
6Assuming the HOMEWORK10 table has three columns (Col1, Col2, and Col3, in this order), which of the following commands stores a NULL value in Col3 of the HOMEWORK10 table?
- AINSERT INTO homework10 VALUES (‘A’, ‘B’, ‘C’);
- BINSERT INTO homework10 (col3, col1, col2) VALUES (NULL, ‘A’, ‘B’);
- CINSERT INTO homework10 VALUES (NULL, ‘A’, ‘B’);
- DUPDATE homework10 SET col1 = col3;
7Which of the following symbols designates a substitution variable?
- A&
- B$
- C#
- D_
8Which of the following input values results in a successful INSERT of O’hara?
- A‘O^hara’
- B‘O’’hara’ (two single quotes following the O)
- C‘O’’hara’ (a double quote following the O)
- DData values can’t contain quotes.
9Which of the following commands locks the HOMEWORK10 table in EXCLUSIVE mode?
- ALOCK TABLE homework10 EXCLUSIVELY;
- BLOCK TABLE homework10 IN EXCLUSIVE MODE;
- CLOCK TABLE homework10 TO OTHER USERS;
- DLOCK homework10 IN EXCLUSIVE MODE;
- EBoth b and d lock the table in EXCLUSIVE mode.
10You issue the following command: INSERT INTO homework10 (col1, col2, col3) VALUES (‘A’, NULL, ‘C’). The command will fail if which of the following statements is true
- ACol1 has a PRIMARY KEY constraint enabled.
- BCol2 has a UNIQUE constraint enabled.
- CCol3 is defined as a DATE column.
- DNone of the above would cause the command to fail.
11Which of the following releases a lock currently held by a user on the HOMEWORK10 table?
- AA COMMIT command is issued.
- BA DDL command is issued to end a transaction.
- CThe user exits the system.
- DA ROLLBACK command is issued.
- Eall of the above
- Fnone of the above
12Assume you have added eight new orders to the ORDERS table. Which of the following is true?
- AOther users can view the new orders as soon as you execute the INSERT INTO command.
- BOther users can view the new orders as soon as you issue a ROLLBACK command.
- COther users can view the new orders as soon as you exit the system or execute a COMMIT command.
- DOther users can view the new orders only if they place an exclusive lock on the table.
13Which of the following commands removes all orders placed before April 1, 2009?
- ADELETE FROM orders WHERE orderdate < ‘01-APR-09’;
- BDROP FROM orders WHERE orderdate < ‘01-APR-09’;
- CREMOVE FROM orders WHERE orderdate < ‘01-APR-09’;
- DDELETE FROM orders WHERE orderdate > ‘01-APR-09’;
14How many rows can be added to a table by executing the INSERT INTO . . . VALUES command?
- A1
- B2
- C3
- Dunlimited
15You accidentally deleted all the orders in the ORDERS table. How can the error be corrected after a COMMIT command has been issued?
- AROLLBACK;
- BROLLBACK COMMIT;
- CREGENERATE RECORDS orders;
- DNone of the above restores the deleted orders.
16Which of the following is the standard extension used for a script file?
- A.spt
- B.srt
- C.script
- D.sql
17A rollback occurs automatically when:
- AA DDL command is executed.
- BA DML command is executed.
- CThe user exits the system.
- Dnone of the above
18What is the maximum number of rows that can be deleted from a table at one time?
- A1
- B2
- C3
- Dunlimited
19Which of the following is a correct statement?
- AIf you attempt to add a record that violates a constraint for one of the table’s columns, only the valid columns for the row are added.
- BA subquery nested in the VALUES clause of an INSERT INTO command can return only one value without generating an Oracle 11g error message.
- CIf you attempt to add a record that violates a NOT NULL constraint, a blank space is inserted automatically in the appropriate column so that Oracle 11g can complete the DML operation.
- DNone of the above statements is correct.
20What is the maximum number of records that can be modified with a single UPDATE command?
- A1
- B2
- C3
- Dunlimited
21Which of the following generates a series of integers that can be stored in a database?
- Aa number generator
- Ba view
- Ca sequence
- Dan index
- Ea synonym
22Which syntax is correct for removing a public synonym?
- ADROP SYNONYM synonymname;
- BDELETE PUBLIC SYNONYM synonymname;
- CDROP PUBLIC SYNONYM synonymname;
- DDELETE SYNONYM synonymname;
23Which of the following commands can you use to modify an index?
- AALTER SESSION
- BALTER TABLE
- CMODIFY INDEX
- DALTER INDEX
- Enone of the above
24Which of the following generates an integer in a sequence?
- ANEXTVAL
- BCURVAL
- CNEXT_VALUE
- DCURR_VALUE
- ENEXT_VAL
- FCUR_VAL
25Which of the following is a valid SQL statement?
- AINSERT INTO publisher
VALUES (pubsequence.nextvalue, 'HAPPY
PRINTING', 'LAZY LARRY', NULL); - BCREATE INDEX a_new_index
ON (firstcolumn*.02); - CCREATE SYNONYM pub
FOR publisher; - Dall of the above
- Enone of the above
- AINSERT INTO publisher
26Suppose the user Juan creates a table called MYTABLE with four columns. The first column has a PRIMARY KEY constraint, the second column has a NOT NULL constraint, the third column has a CHECK constraint, and the fourth column has a FOREIGN KEY constraint. Given this information, how many indexes does Oracle 11g create automatically when the table and constraints are created?
- A0
- B1
- C2
- D3
- E4
27Given the table created in Question 6, which of the following commands can Juan use to create a synonym that allows anyone to access the table without having to identify his schema in the table reference?
- ACREATE SYNONYM thetable
FOR juan.mytable; - BCREATE PUBLIC SYNONYM thetable
FOR mytable; - CCREATE SYNONYM juan
FOR mytable; - Dnone of the above
- ACREATE SYNONYM thetable
28Which of the following statements is true?
- AA gap can appear in a sequence created with the NOCACHE option if the system crashes before a user can commit a transaction.
- BAny unassigned sequence values appears in the USER_SEQUENCE data dictionary table as unassigned.
- COnly the user who creates a sequence is allowed to delete it.
- DOnly the user who created a sequence is allowed to use the value generated by the sequence.
29When is creating an index manually inappropriate?
- Awhen queries return a large percentage of rows in the results
- Bwhen the table is small
- Cwhen the majority of table operations are updates
- Dall of the above
- Ewhen queries return a large percentage of rows in the results and when the majority of table operations are updates
30If a column has high selectivity or cardinality, which index type is most appropriate?
- AIOT
- BB-tree
- Cbitmap
- Dfunction-based index
31If a column has low selectivity, this means:
- AThe column contains many distinct values.
- BThe column contains a small number of distinct values.
- CA WHERE clause is always used in a query on the column.
- DThe selectivity of a column can’t be determined.
32Oracle 11g automatically creates an index for which type of constraints?
- ANOT NULL
- BPRIMARY KEY
- CFOREIGN KEY
- DUNIQUE KEY
- Enone of the above
- FNOT NULL and PRIMARY KEY
- GPRIMARY KEY and UNIQUE KEY
33Which of the following settings can’t be modified with the ALTER SEQUENCE command?
- AINCREMENT BY
- BMAXVALUE
- CSTART WITH
- DMINVALUE
- ECACHE
34Which node of the b-tree index contains ROWIDs?
- Abranch blocks
- Broot block
- Cleaf blocks
- DNone of the above because the primary key is used to identify rows.
35If the CACHE or NOCACHE options aren’t included in the CREATE SEQUENCE command, which of the following statements is correct?
- AOracle 11g generates 20 integers automatically and stores them in memor
- BNo integers are cached by default.
- COnly one integer is cached at a time
- DThe command will fail.
- EOracle 11g generates 20 three-digit decimal numbers automatically and stores them in memory.
36Which of the following is a valid command?
- ACREATE INDEX book_profit_idx
ON (retail-cost) WHERE (retail-cost) > 10; - BCREATE INDEX book_profit_idx
ON (retail-cost); - CCREATE FUNCTION INDEX book_profit_idx
ON books WHERE (retail-cost) > 10; - Dnone of the above
- ACREATE INDEX book_profit_idx
37Which of the following can be used to determine whether an index exists?
- ADESCRIBE indexname;
- Bthe USER_INDEXES view
- Cthe USER_INDEX view
- Dall of the above
- Enone of the above
38Which of the following isn’t a valid option for the CREATE SEQUENCE command?
- AORDER
- BNOCYCLE
- CMINIMUMVAL
- DNOCACHE
- EAll of the above are valid options.
39What can be referenced to determine whether an index is used to perform a query?
- AUSER_INDEXES view
- Bquery source code
- Cexplain plan
- Ddatabase access plan
40Which of the following commands creates a private synonym?
- ACREATE PRIVATE SYNONYM
- BCREATE NONPUBLIC SYNONYM
- CCREATE SYNONYM
- DCREATE PUBLIC SYNONYM
41Which of the following commands can be used to change a password for a user account?
- AALTER PASSWORD
- BCHANGE PASSWORD
- CMODIFY USER PASSWORD
- DALTER USER . . . PASSWORD
- Enone of the above
42Which of the following statements assigns the role CUSTOMERREP as the default role for Maurice Cain?
- AALTER ROLE mcain
DEFAULT ROLE customerrep; - BALTER USER mcain
TO customerrep; - CSET DEFAULT ROLE customerrep
FOR mcain; - DALTER USER mcain
DEFAULT ROLE customerrep - ESET ROLE customerrep
FOR mcain;
- AALTER ROLE mcain
43Which of the following statements is most accurate?
- AAuthentication procedures prevent any data stored in the Oracle 11g database from being stolen or damaged.
- BAuthentication procedures are used to limit unauthorized access to the Oracle 11g database.
- COracle 11g authentication doesn’t prevent users from accessing data in the database if they have a valid operating system account.
- DAuthentication procedures restrict the type of data manipulation operations that a user can perform.
44Which of the following statements creates a user account named DeptHead?
- ACREATE ROLE depthead
IDENTIFIED BY apassword; - BCREATE USER depthead
IDENTIFIED BY apassword; - CCREATE ACCOUNT depthead;
- DGRANT ACCOUNT depthead;
- ACREATE ROLE depthead
45Which of the following privileges must be granted to a user’s account before the user can connect to the Oracle 11g database?
- ACONNECT
- BCREATE SESSION
- CCONNECT ANY DATABASE
- DCREATE ANY TABLE
46Which of the following privileges allows a user to truncate tables in a database?
- ADROP ANY TABLE
- BTRUNCATE ANY TABLE
- CCREATE TABLE
- DTRUNC TABLE
47Which of the following tables or views displays the current enabled privileges for a user?
- ASESSION_PRIVS
- BSYSTEM_PRIVILEGE_MAP
- CUSER_ASSIGNED_PRIVS
- DV$ENABLED_PRIVILEGES
48Which of the following commands eliminates only the user ELOPEZ’s ability to enter new books in the BOOKS table?
- AREVOKE insert
ON books
FROM elopez; - BREVOKE insert
FROM elopez; - CREVOKE INSERT INTO
FROM elopez; - DDROP insert
INTO books
FROM elopez;
- AREVOKE insert
49Which of the following commands is used to assign a privilege to a role?
- ACREATE ROLE
- BCREATE PRIVILEGE
- CGRANT
- DALTER PRIVILEGE
50Which of the following options requires a user to change his or her password at the next login?
- ACREATE USER
- BALTER USER
- CIDENTIFIED BY
- DPASSWORD EXPIRE
51Which of the following options allows a user to grant system privileges to other users?
- AWITH ADMIN OPTION
- BWITH GRANT OPTI
- CDBA
- DASSIGN ROLES
- ESET ROLE
52Which of the following is an object privilege?
- ACREATE SESSION
- BDROP USER
- CINSERT ANY TABLE
- DUPDATE
53Which of the following privileges can be granted only to a user, not to a role?
- ASELECT
- BCREATE ANY
- CREFERENCES
- DREAD
- EWRITE
54Which of the following is used to grant all object privileges for an object to a specified user?
- AALL
- BPUBLIC
- CANY
- DOBJECT
55Which of the following identifies a collection of privileges?
- Aan object privilege
- Ba system privilege
- CDEFAULT privilege
- Da role
56Which of the following is true?
- AIf the DBA changes the password for a user while the user is connected to the database, the connection terminates automatically.
- BIf the DBA revokes the CREATE SESSION privilege from a user account, the user can’t connect to the database.
- CIf a user is granted the privilege to create a table and the privilege is revoked after the user creates a table, the table is dropped from the system automatically.
- Dall of the above
57Which of the following commands can be used to eliminate the RECEPTIONIST role?
- ADELETE ROLE receptionist;
- BDROP receptionist;
- CDROP ANY ROLE;
- Dnone of the above
58Which of the following displays a list of all system privileges available in Oracle 11g?
- ASESSION_PRIVS
- BSYS_PRIVILEGE_MAP
- CV$SYSTEM_PRIVILEGES
- DSYSTEM_PRIVILEGE_MAP
59Which of the following can be used to change the role that’s currently enabled for a user?
- ASET DEFAULT ROLE
- BALTER ROLE
- CALTER SESSION
- DSET ROLE
60Which of the following is an object privilege?
- ADELETE ANY
- BINSERT ANY
- CUPDATE ANY
- DREFERENCE
61Which of the following SQL statements isn’t valid?
- ASELECT address || city || state || zip "Address" FROM customers
WHERE lastname ¼ 'SMITH'; - BSELECT * FROM publisher ORDER BY contact;
- CSELECT address, city, state, zip FROM customers
WHERE lastname ¼ "SMITH"; - DAll the above statements are valid and return the expected results.
- ASELECT address || city || state || zip "Address" FROM customers
62Which clause is used to restrict rows or perform selection?
- ASELECT
- BFROM
- CWHERE
- DORDER BY
63Which of the following SQL statements is valid?
- ASELECT order# FROM orders WHERE shipdate ¼ NULL;
- BSELECT order# FROM orders WHERE shipdate ¼ 'NULL';
- CSELECT order# FROM orders WHERE shipdate ¼ "NULL";
- DNone of the statements are valid.
64Which of the following returns a list of all customers’ names sorted in descending order by city within state?
- ASELECT name FROM customers
ORDER BY desc state, city; - BSELECT firstname, lastname FROM customers
SORT BY desc state, city; - CSELECT firstname, lastname FROM customers
ORDER BY state desc, city; - DSELECT firstname, lastname FROM customers
ORDER BY state desc, city desc; - ESELECT firstname, lastname FROM customers
ORDER BY 5 desc, 6 desc;
- ASELECT name FROM customers
65Which of the following doesn’t return a customer with the last name THOMPSON in the query results?
- ASELECT lastname FROM customers WHERE lastname ¼ "THOMPSON";
- BSELECT * FROM customers;
- CSELECT lastname FROM customers WHERE lastname 4 'R';
- DSELECT * FROM customers WHERE lastname 5 'V';
66Which of the following displays all books published by Publisher 1 with a retail price of at least $25.00?
- ASELECT * FROM books WHERE pubid = 1 AND retail >= 25;
- BSELECT * FROM books WHERE pubid = 1 OR retail >= 25;
- CSELECT * FROM books WHERE pubid = 1 AND WHERE retail > 25;
- DSELECT * FROM books WHERE pubid = 1, retail >= 25;
- ESELECT * FROM books WHERE pubid = 1, retail >= $25.00;
67What’s the default sort sequence for the ORDER BY clause?
- Aascending
- Bdescending
- Cthe order in which records are stored in the table
- DThere’s no default sort sequence.
68Which of the following doesn’t include the display of books published by Publisher 2 and having a retail price of at least $35.00?
- ASELECT * FROM books WHERE pubid = 2, retail >= $35.00;
- BSELECT * FROM books WHERE pubid = 2 AND NOT retail < 35;
- CSELECT * FROM books WHERE pubid IN (1, 2, 5)
AND retail NOT BETWEEN 1 AND 29.99; - DAll the above statements display the specified books.
- ENone of the above statements display the specified boo
69Which of the following includes a customer with the first name BONITA in the results?
- ASELECT * FROM customers WHERE firstname = 'B%';
- BSELECT * FROM customers WHERE firstname LIKE '%N%';
- CSELECT * FROM customers WHERE firstname = '%N%';
- DSELECT * FROM customers WHERE firstname LIKE '_B%';
70Which of the following represents exactly one character in a pattern search?
- AESCAPE
- B?
- C_
- D%
- Enone of the above
71Which of the following returns the book HANDCRANKED COMPUTERS in the results?
- ASELECT * FROM books WHERE title = 'H_N_%';
- BSELECT * FROM books WHERE title LIKE "H_N_C%";
- CSELECT * FROM books WHERE title LIKE 'H_N_C%';
- DSELECT * FROM books WHERE title LIKE '_H%';
72Which of the following clauses is used to display query results in a sorted order?
- AWHERE
- BSELECT
- CSORT
- DORDER
- Enone of the above
73Which of the following SQL statements returns all books published after March 20, 2005?
- ASELECT * FROM books WHERE pubdate > 03–20–2005;
- BSELECT * FROM books WHERE pubdate > '03–20–2005';
- CSELECT * FROM books WHERE pubdate > '20–MAR–05';
- DSELECT * FROM books WHERE pubdate > 'MAR–20–05';
74Which of the following lists all books published before June 2, 2004 and all books published by Publisher 4 or in the Fitness category?
- ASELECT * FROM books WHERE category = 'FITNESS' OR pubid = 4
AND pubdate < '06–02–2004'; - BSELECT * FROM books WHERE category = 'FITNESS' AND pubid = 4
OR pubdate < '06–02–2004'; - CSELECT * FROM books WHERE category = 'FITNESS' OR (pubid = 4
AND pubdate < '06–02–2004'); - DSELECT * FROM books WHERE category ¼ 'FITNESS'
OR pubid = 4, pubdate < '06–02–04'; - Enone of the above
- ASELECT * FROM books WHERE category = 'FITNESS' OR pubid = 4
75Which of the following finds all orders placed before April 5, 2009 that haven’t yet shipped?
- ASELECT * FROM orders WHERE orderdate < '04–05–09'
AND shipdate = NULL; - BSELECT * FROM orders WHERE orderdate < '05–04–09'
AND shipdate IS NULL; - CSELECT * FROM orders WHERE orderdate < 'APR–05–09'
AND shipdate IS NULL; - DSELECT * FROM orders WHERE orderdate < '05–APR–09'
AND shipdate IS NULL; - Enone of the above
- ASELECT * FROM orders WHERE orderdate < '04–05–09'
76Which of the following symbols represents any number of characters in a pattern search?
- A*
- B?
- C%
- D_
77Which of the following lists books generating at least $12.00 in profit?
- ASELECT * FROM books WHERE retail-cost > 12;
- BSELECT * FROM books WHERE retail-cost <= 12;
- CSELECT * FROM books WHERE profit >= 12;
- DSELECT * FROM books WHERE retail-cost =>12.00;
- Enone of the above
78Which of the following lists each book having a profit of at least $10.00 in descending order by profit?
- ASELECT * FROM books WHERE profit => 10.00
ORDER BY "Profit" desc; - BSELECT title, retail-cost "Profit" FROM books
WHERE profit => 10.00
ORDER BY "Profit" desc; - CSELECT title, retail-cost "Profit" FROM books
WHERE "Profit" => 10.00
ORDER BY "Profit" desc; - DSELECT title, retail-cost profit FROM books
WHERE retail-cost >= 10.00
ORDER BY "PROFIT" desc; - ESELECT title, retail-cost "Profit" FROM books
WHERE profit => 10.00
ORDER BY 3 desc;
- ASELECT * FROM books WHERE profit => 10.00
79Which of the following includes the book HOW TO GET FASTER PIZZA in the query results?
- ASELECT * FROM books WHERE title LIKE '%AS_E%';
- BSELECT * FROM books WHERE title LIKE 'AS_E%';
- CSELECT * FROM books WHERE title = '%AS_E%'
- DSELECT * FROM books WHERE title = 'AS_E%';
80Which of the following returns all books published after March 20, 2005?
- ASELECT * FROM books WHERE pubdate > 03–20–2005;
- BSELECT * FROM books WHERE pubdate > '03–20–2005';
- CSELECT * FROM books WHERE pubdate NOT < '20–MAR–05';
- DSELECT * FROM books WHERE pubdate NOT < 'MAR–20–05';
- Enone of the above
81Which of the following queries creates a Cartesian join?
- ASELECT title, authorid
FROM books, bookauthor; - BSELECT title, name
FROM books CROSS JOIN publisher; - CSELECT title, gift
FROM books NATURAL JOIN promotion; - Dall of the above
- ASELECT title, authorid
82Which of the following operators is not allowed in an outer join?
- AAND
- B=
- COR
- D>
83Which of the following queries contains an equality join?
- ASELECT title, authorid
FROM books, bookauthor
WHERE books.isbn = bookauthor.isbn
AND retail > 20; - BSELECT title, name
FROM books CROSS JOIN publisher; - CSELECT title, gift
FROM books, promotion
WHERE retail >= minretail
AND retail <= maxretail; - Dnone of the above
- ASELECT title, authorid
84Which of the following queries contains a non-equality join?
- ASELECT title, authorid
FROM books, bookauthor
WHERE books.isbn = bookauthor.isbn
AND retail > 20; - BSELECT title, name
FROM books JOIN publisher
USING (pubid); - CSELECT title, gift
FROM books, promotion
WHERE retail >= minretail
AND retail <= maxretail; - Dnone of the above
- ASELECT title, authorid
85The following SQL statement contains which type of join?
SELECT title, order#, quantity
FROM books FULL JOIN orderitems
ON books.isbn = orderitems.isbn;- Aequality
- Bself-join
- Cnon-equality
- Douter join
86Which of the following queries is valid?
- ASELECT b.title, b.retail, o.quantity
FROM books b NATURAL JOIN orders od
NATURAL JOIN orderitems o
WHERE od.order# = 1005; - BSELECT b.title, b.retail, o.quantity
FROM books b, orders od, orderitems o
WHERE orders.order# = orderitems.order#
AND orderitems.isbn=books.isbn
AND od.order#=1005; - CSELECT b.title, b.retail, o.quantity
FROM books b, orderitems o
WHERE o.isbn = b.isbn
AND o.order#=1005; - Dnone of the above
- ASELECT b.title, b.retail, o.quantity
87Given the following query:
SELECT zip, order#
FROM customers NATURAL JOIN orders;
Which of the following queries is equivalent?- ASELECT zip, order#
FROM customers JOIN orders
WHERE customers.customer# = orders.customer#; - BSELECT zip, order#
FROM customers, orders
WHERE customers.customer# = orders.customer#; - CSELECT zip, order#
FROM customers, orders
WHERE customers.customer# = orders.customer# (+); - Dnone of the above
- ASELECT zip, order#
88Which line in the following SQL statement raises an error?
1. SELECT name, title
2. FROM books NATURAL JOIN publisher
3. WHERE category = 'FITNESS'
4. OR
5. books.pubid = 4;- Aline 1
- Bline 2
- Cline 3
- Dline 4
- Eline 5
89Given the following query:
SELECT lastname, firstname, order#
FROM customers LEFT OUTER JOIN orders
USING (customer#)
ORDER BY customer#;
Which of the following queries returns the same results?- ASELECT lastname, firstname, order#
FROM customers c OUTER JOIN orders o
ON c.customer# = o.customer#
ORDER BY c.customer#; - BSELECT lastname, firstname, order#
FROM orders o RIGHT OUTER JOIN customers c
ON c.customer# = o.customer#
ORDER BY c.customer#; - CSELECT lastname, firstname, order#
FROM customers c, orders o
WHERE c.customer# = o.customer# (+)
ORDER BY c.customer#; - Dnone of the above
- ASELECT lastname, firstname, order#
90Given the following query:
SELECT DISTINCT zip, category
FROM customers NATURAL JOIN orders NATURAL JOIN orderitems
NATURAL JOIN books;
Which of the following queries is equivalent?- ASELECT zip FROM customers
UNION
SELECT category FROM books; - BSELECT DISTINCT zip, category
FROM customers c, orders o, orderitems oi, books b
WHERE c.customer# = o.customer# AND o.order# =
oi.order#
AND oi.isbn = b.isbn; - CSELECT DISTINCT zip, category
FROM customers c JOIN orders o
JOIN orderitems oi JOIN books b
ON c.customer# = o.customer#
AND o.order# = oi.order#
AND oi.isbn = b.isbn; - Dall of the above
- Enone of the above
- ASELECT zip FROM customers
91Which line in the following SQL statement raises an error?
1. SELECT name, title
2. FROM books JOIN publisher
3. WHERE books.pubid = publisher.pubid
4. AND
5. cost <45.95- Aline 1
- Bline 2
- Cline 3
- Dline 4
- Eline 5
92Given the following query:
SELECT title, gift
FROM books CROSS JOIN promotion;
Which of the following queries is equivalent?- ASELECT title, gift
FROM books NATURAL JOIN promotion; - BSELECT title
FROM books INTERSECT
SELECT gift
FROM promotion; - CSELECT title
FROM books UNION ALL
SELECT gift
FROM promotion; - Dall of the above
- ASELECT title, gift
93If the CUSTOMERS table contains seven records and the ORDERS table has eight records,
how many records does the following query produce?
SELECT *
FROM customers CROSS JOIN orders;- A0
- B8
- C7
- D15
- E56
94Which of the following SQL statements is not valid?
- ASELECT b.isbn, p.name
FROM books b NATURAL JOIN publisher p; - BSELECT isbn, name
FROM books b, publisher p
WHERE b.pubid = p.pubid; - CSELECT isbn, name
FROM books b JOIN publisher p
ON b.pubid = p.pubid; - DSELECT isbn, name
FROM books JOIN publisher
USING (pubid); - ENone—all the above are valid SQL statements.
- ASELECT b.isbn, p.name
95Which of the following lists all books published by the publisher named Printing Is Us?
- ASELECT title
FROM books NATURAL JOIN publisher
WHERE name = 'PRINTING IS US'; - BSELECT title
FROM books, publisher
WHERE pubname = 1; - CSELECT *
FROM books b, publisher p
JOIN tables ON b.pubid = p.pubid
WHERE name = 'PRINTING IS US'; - Dnone of the above
- ASELECT title
96Which of the following SQL statements is not valid?
- ASELECT isbn
FROM books
MINUS
SELECT isbn
FROM orderitems; - BSELECT isbn, name
FROM books, publisher
WHERE books.pubid (+) = publisher.pubid (+); - CSELECT title, name
FROM books NATURAL JOIN publisher - DAll the above SQL statements are valid.
- ASELECT isbn
97Which of the following statements about an outer join between two tables is true?
- AIf the relationship between the tables is established with a WHERE clause, both tables can include the outer join operator.
- BTo include unmatched records in the results, the record is paired with a NULL record in the deficient table.
- CThe RIGHT, LEFT, and FULL keywords are equivalent.
- Dall of the above
- Enone of the above
98Which line in the following SQL statement raises an error?
1. SELECT name, title
2. FROM books b, publisher p
3. WHERE books.pubid = publisher.pubid
4. AND
5. (retail > 25 OR retail-cost > 18.95);- Aline 1
- Bline 3
- Cline 4
- Dline 5
99What is the maximum number of characters allowed in a table alias?
- A10
- B30
- C255
- D256
100Which of the following SQL statements is valid?
- ASELECT books.title, orderitems.quantity
FROM books b, orderitems o
WHERE b.isbn= o.ibsn; - BSELECT title, quantity
FROM books b JOIN orderitems o; - CSELECT books.title, orderitems.quantity
FROM books JOIN orderitems
ON books.isbn = orderitems.isbn; - Dnone of the above
- ASELECT books.title, orderitems.quantity
101Which of the following is a valid SQL statement?
- ASELECT SYSDATE;
- BSELECT UPPER(Hello) FROM dual;
- CSELECT TO_CHAR(SYSDATE, 'Month DD, YYYY')
FROM dual; - Dall of the above
- Enone of the above
102Which of the following functions can be used to extract a portion of a character string?
- AEXTRACT
- BTRUNC
- CSUBSTR
- DINITCAP
103Which of the following determines how long ago orders that haven’t shipped were received?
- ASELECT order#, shipdate-orderdate delay
FROM orders; - BSELECT order#, SYSDATE – orderdate
FROM orders
WHERE shipdate IS NULL; - CSELECT order#, NVL(shipdate, 0)
FROM orders
WHERE orderdate is NULL; - DSELECT order#, NULL(shipdate)
FROM orders;
- ASELECT order#, shipdate-orderdate delay
104Which of the following SQL statements produces “Hello World” as the output?
- ASELECT "Hello World" FROM dual;
- BSELECT INITCAP('HELLO WORLD') FROM dual;
- CSELECT LOWER('HELLO WORLD') FROM dual;
- DSELECT "Hello World" FROM dual;
(and)
SELECT INITCAP('HELLO WORLD') FROM dual; - Enone of the above
105Which of the following functions can be used to substitute a value for a NULL value?
- ANVL
- BTRUNC
- CNVL2
- DSUBSTR
- ENVL & SUBSTR
- FSUBSTR & NVL2
106Which of the following is not a valid format argument for displaying the current time?
- A'HH:MM:SS'
- B'HH24:SS'
- C'HH12:MI:SS'
- DAll of the above are valid.
107Which of the following lists only the last four digits of the contact person’s phone number at American Publishing?
- ASELECT EXTRACT(phone, -4, 1)
FROM publisher
WHERE name ¼ 'AMERICAN PUBLISHING'; - BSELECT SUBSTR(phone, -4, 1)
FROM publisher
WHERE name = 'AMERICAN PUBLISHING'; - CSELECT EXTRACT(phone, -1, 4)
FROM publisher
WHERE name = 'AMERICAN PUBLISHING'; - DSELECT SUBSTR(phone, -4, 4)
FROM publisher
WHERE name = 'AMERICAN PUBLISHING';
- ASELECT EXTRACT(phone, -4, 1)
108Which of the following functions can be used to determine how many months a book has been available?
- AMONTH
- BMON
- CMONTH_BETWEEN
- Dnone of the above
109Which of the following displays the order date for order 1000 as 03/31?
- ASELECT TO_CHAR(orderdate, 'MM/DD')
FROM orders
WHERE order# = 1000; - BSELECT TO_CHAR(orderdate, 'Mth/DD')
FROM orders
WHERE order# = 1000; - CSELECT TO_CHAR(orderdate, 'MONTH/YY')
FROM orders
WHERE order# = 1000; - Dnone of the above
- ASELECT TO_CHAR(orderdate, 'MM/DD')
110Which of the following functions can produce different results, depending on the value of a specified column?
- ANVL
- BDECODE
- CUPPER
- DSUBSTR
111Which of the following SQL statements is not valid?
- ASELECT TO_CHAR(orderdate, '99/9999')
FROM orders; - BSELECT INITCAP(firstname), UPPER(lastname)
FROM customers; - CSELECT cost, retail,
TO_CHAR(retail-cost, '$999.99') profit
FROM books; - Dall of the above
- ASELECT TO_CHAR(orderdate, '99/9999')
112Which function can be used to add spaces to a column until it’s a specific width?
- ATRIML
- BPADL
- CLWIDTH
- Dnone of the above
113Which of the following SELECT statements returns 30 as the result?
- ASELECT ROUND(24.37, 2) FROM dual;
- BSELECT TRUNC(29.99, 2) FROM dual;
- CSELECT ROUND(29.01, -1) FROM dual;
- DSELECT TRUNC(29.99, -1) FROM dual;
114Which of the following is a valid SQL statement?
- ASELECT TRUNC(ROUND(125.38, 1), 0) FROM dual;
- BSELECT ROUND(TRUNC(125.38, 0)
FROM dual; - CSELECT LTRIM(LPAD(state, 5, ' '), 4, -3, "*")
FROM dual; - DSELECT SUBSTR(ROUND(14.87, 2, 1), -4, 1)
FROM dual;
115Which of the following functions can’t be used to convert the letter case of a character string?
- AUPPER
- BLOWER
- CINITIALCAP
- DAll of the above can be used for case conversion.
116Which of the following format elements causes months to be displayed as a three-letter abbreviation?
- AMMM
- BMONTH
- CMON
- Dnone of the above
117Which of the following SQL statements displays a customer’s name in all uppercase characters?
- ASELECT UPPER('firstname', 'lastname')
FROM customers; - BSELECT UPPER(firstname, lastname)
FROM customers; - CSELECT UPPER(lastname, ',' firstname)
FROM customers; - Dnone of the above
- ASELECT UPPER('firstname', 'lastname')
118Which of the following functions can be used to display the character string FLORIDA in the query results whenever FL is entered in the State field?
- ASUBSTR
- BNVL2
- CREPLACE
- DTRUNC
- Enone of the above
119What’s the name of the table provided by Oracle 11g for completing queries that don’t involve a table?
- ADUMDUM
- BDUAL
- CORAC
- DSYS
120If an integer is multiplied by a NULL value, the result is:
- Aan integer
- Ba whole number
- Ca NULL value
- DNone of the above—a syntax error message is returned.
121Which of the following statements is true?
- AThe MIN function can be used only with numeric data.
- BThe MAX function can be used only with date values.
- CThe AVG function can be used only with numeric data.
- DThe SUM function can’t be part of a nested function.
122Which of the following is a valid SELECT statement?
- ASELECT AVG(retail-cost)
FROM books
GROUP BY category; - BSELECT category, AVG(retail-cost)
FROM books; - CSELECT category, AVG(retail-cost)
FROM books
WHERE AVG(retail-cost) > 8.56
GROUP BY category; - DSELECT category, AVG(retail-cost) Profit
FROM books
GROUP BY category
HAVING profit > 8.56;
- ASELECT AVG(retail-cost)
123Which of the following statements is correct?
- AThe WHERE clause can contain a group function only if the function isn’t also listed in the SELECT clause.
- BGroup functions can’t be used in the SELECT, FROM, or WHERE clauses.
- CThe HAVING clause is always processed before the WHERE clause.
- DThe GROUP BY clause is always processed before the HAVING clause.
124Which of the following is not a valid SQL statement?
- ASELECT MIN(pubdate)
FROM books
GROUP BY category
HAVING pubid = 4; - BSELECT MIN(pubdate)
FROM books
WHERE category = 'COOKING'; - CSELECT COUNT(*)
FROM orders
WHERE customer# = 1005; - DSELECT MAX(COUNT(customer#))
FROM orders
GROUP BY customer#;
- ASELECT MIN(pubdate)
125Which of the following statements is correct?
- AThe COUNT function can be used to determine how many rows contain a NULL value.
- BOnly distinct values are included in group functions, unless the ALL keyword is included in the SELECT clause.
- CThe HAVING clause restricts which rows are processed.
- DThe WHERE clause determines which groups are displayed in the query results.
- Enone of the above
126Which of the following is a valid SQL statement?
- ASELECT customer#, order#, MAX(shipdate-orderdate)
FROM orders
GROUP BY customer#
WHERE customer# = 1001; - BSELECT customer#, COUNT(order#)
FROM orders
GROUP BY customer#; - CSELECT customer#, COUNT(order#)
FROM orders
GROUP BY COUNT(order#); - DSELECT customer#, COUNT(order#)
FROM orders
GROUP BY order#;
- ASELECT customer#, order#, MAX(shipdate-orderdate)
127Which of the following SELECT statements lists only the book with the largest profit?
- ASELECT title, MAX(retail-cost)
FROM books
GROUP BY title; - BSELECT title, MAX(retail-cost)
FROM books
GROUP BY title
HAVING MAX(retail-cost); - CSELECT title, MAX(retail-cost)
FROM books; - Dnone of the above
- ASELECT title, MAX(retail-cost)
128Which of the following is correct?
- AA group function can be nested inside a group function.
- BA group function can be nested inside a single-row function.
- CA single-row function can be nested inside a group function.
- DA group function can be nested inside a group function, and A group function can be nested inside a single-row function.
- EA group function can be nested inside a group function, and A group function can be nested inside a single-row function, and A single-row function can be nested inside a group function.
129Which of the following functions is used to calculate the total value stored in a specified column?
- ACOUNT
- BMIN
- CTOTAL
- DSUM
- EADD
130Which of the following SELECT statements lists the highest retail price of all books in the Family category?
- ASELECT MAX(retail)
FROM books
WHERE category = 'FAMILY'; - BSELECT MAX(retail)
FROM books
HAVING category = 'FAMILY'; - CSELECT retail
FROM books
WHERE category = 'FAMILY'
HAVING MAX(retail); - Dnone of the above
- ASELECT MAX(retail)
131Which of the following functions can be used to include NULL values in calculations?
- ASUM
- BNVL
- CMAX
- DMIN
132Which of the following is not a valid statement?
- AYou must enter the ALL keyword in a group function to include all duplicate value
- BThe AVG function can be used to find the average calculated difference between two dates.
- CThe MIN and MAX functions can be used on any type of data.
- Dall of the above
- Enone of the above
133Which of the following SQL statements determines how many total customers were referred by other customers?
- ASELECT customer#, SUM(referred)
FROM customers
GROUP BY customer#; - BSELECT COUNT(referred)
FROM customers; - CSELECT COUNT(*)
FROM customers; - DSELECT COUNT(*)
FROM customers
WHERE referred IS NULL;
- ASELECT customer#, SUM(referred)
1341 SELECT customer#, COUNT(*)
2 FROM customers JOIN orders USING (customer#)
3 WHERE orderdate > '02-APR-09'
4 GROUP BY customer#
5 HAVING COUNT(*) > 2;
Which line of the SELECT statement is used to restrict the number of records the query processes?- A1
- B3
- C4
- D5
1351 SELECT customer#, COUNT(*)
2 FROM customers JOIN orders USING (customer#)
3 WHERE orderdate > '02-APR-09'
4 GROUP BY customer#
5 HAVING COUNT(*) > 2;
Which line of the SELECT statement is used to restrict groups displayed in the query results?- A1
- B3
- C4
- D5
1361 SELECT customer#, COUNT(*)
2 FROM customers JOIN orders USING (customer#)
3 WHERE orderdate > '02-APR-09'
4 GROUP BY customer#
5 HAVING COUNT(*) > 2;
Which line of the SELECT statement is used to group data stored in the database?- A1
- B3
- C4
- D5
1371 SELECT customer#, COUNT(*)
2 FROM customers JOIN orders USING (customer#)
3 WHERE orderdate > '02-APR-09'
4 GROUP BY customer#
5 HAVING COUNT(*) > 2;
Because the SELECT clause contains the Customer# column, which clause must be included for the query to execute successfully?- A1
- B3
- C4
- D5
1381 SELECT customer#, COUNT(*)
2 FROM customers JOIN orders USING (customer#)
3 WHERE orderdate > '02-APR-09'
4 GROUP BY customer#
5 HAVING COUNT(*) > 2;
The COUNT(*) function in the SELECT clause is used to return:- Athe number of records in the specified tables
- Bthe number of orders placed by each customer
- Cthe number of NULL values in the specified table
- Dthe number of customers who have placed an order
139Which of the following functions can be used to determine the earliest ship date for all orders recently processed by JustLee Books?
- ACOUNT function
- BMAX function
- CMIN function
- DSTDDEV function
- EVARIANCE function
140Which of the following is not a valid SELECT statement?
- ASELECT STDDEV(retail)
FROM books; - BSELECT AVG(SUM(retail))
FROM orders
NATURAL JOIN orderitems NATURAL JOIN books
GROUP BY customer#; - CSELECT order#, TO_CHAR(SUM(retail),'999.99')
FROM orderitems JOIN books USING (isbn)
GROUP BY order#; - DSELECT title, VARIANCE(retail-cost)
FROM books
GROUP BY pubid;
- ASELECT STDDEV(retail)
141Which query identifies customers living in the same state as the customer named Leila Smith?
- ASELECT customer# FROM customers
WHERE state = (SELECT state FROM customers
WHERE lastname = 'SMITH'); - BSELECT customer# FROM customers
WHERE state = (SELECT state FROM customers
WHERE lastname = 'SMITH'
OR firstname = 'LEILA'); - CSELECT customer# FROM customers
WHERE state = (SELECT state FROM customers
WHERE lastname = 'SMITH'
AND firstname = 'LEILA'
ORDER BY customer); - DSELECT customer# FROM customers
WHERE state = (SELECT state FROM customers
WHERE lastname = 'SMITH'
AND firstname = 'LEILA');
- ASELECT customer# FROM customers
142Which of the following is a valid SELECT statement?
- ASELECT order# FROM orders
WHERE shipdate = SELECT shipdate FROM orders
WHERE order# = 1010; - BSELECT order# FROM orders
WHERE shipdate = (SELECT shipdate FROM orders)
AND order# = 1010; - CSELECT order# FROM orders
WHERE shipdate = (SELECT shipdate FROM orders
WHERE order# = 1010); - DSELECT order# FROM orders
HAVING shipdate = (SELECT shipdate FROM orders
WHERE order# = 1010);
- ASELECT order# FROM orders
143Which of the following operators is considered a single-row operator?
- AIN
- BALL
- C<>
- D<>ALL
144Which of the following queries determines which customers have ordered the same books as customer 1017?
- ASELECT order# FROM orders
WHERE customer# = 1017; - BSELECT customer# FROM orders
JOIN orderitems USING(order#)
WHERE isbn = (SELECT isbn FROM orderitems
WHERE customer# = 1017); - CSELECT customer# FROM orders
WHERE order# = (SELECT order# FROM orderitems
WHERE customer# = 1017); - DSELECT customer# FROM orders
JOIN orderitems USING(order#)
WHERE isbn IN (SELECT isbn FROM orderitems
JOIN orders USING(order#)
WHERE customer# = 1017);
- ASELECT order# FROM orders
145Which of the following statements is valid?
- ASELECT title FROM books
WHERE retail <(SELECT cost FROM books
WHERE isbn = '9959789321'); - BSELECT title FROM books
WHERE retail = (SELECT cost FROM books
WHERE isbn = '9959789321' ORDER BY cost); - CSELECT title FROM books
WHERE category IN (SELECT cost FROM orderitems
WHERE isbn = '9959789321'); - Dnone of the above statements
- ASELECT title FROM books
146Which of the following statements is correct?
- AIf a subquery is used in the outer query's FROM clause, the data in the temporary table can't be referenced by clauses used in the outer query.
- BThe temporary table created by a subquery in the outer query's FROM clause must be assigned a table alias, or it can't be joined with another table by using the JOIN keyword.
- CIf a temporary table is created through a subquery in the outer query's FROM clause, the data in the temporary table can be referenced by another clause in the outer query.
- Dnone of the above
147Which of the following queries identifies other customers who were referred to JustLee Books by the same person who referred Jorge Perez?
- ASELECT customer# FROM customers
WHERE referred = (SELECT referred FROM customers
WHERE firstname = 'JORGE'
AND lastname = 'PEREZ'); - BSELECT referred FROM customers
WHERE (customer#, referred) = (SELECT customer#
FROM customers WHERE firstname = 'JORGE'
AND lastname = 'PEREZ'); - CSELECT referred FROM customers
WHERE (customer#, referred) IN (SELECT customer#
FROM customers WHERE firstname = 'JORGE'
AND lastname = 'PEREZ'); - DSELECT customer# FROM customers
WHERE customer# = (SELECT customer#
FROM customers WHERE firstname = 'JORGE'
AND lastname = 'PEREZ');
- ASELECT customer# FROM customers
148In which of the following situations is using a subquery suitable?
- Awhen you need to find all customers living in a particular region of the country
- Bwhen you need to find all publishers who have toll-free telephone numbers
- Cwhen you need to find the titles of all books shipped on the same date as an order placed by a particular customer
- Dwhen you need to find all books published by Publisher
149Which of the following queries identifies customers who have ordered the same books as customers 1001 and 1005?
- ASELECT customer# FROM orders
JOIN books USING(isbn)
WHERE isbn = (SELECT isbn FROM orderitems
JOIN books USING(isbn)
WHERE customer# = 1001 OR customer# = 1005)); - BSELECT customer# FROM orders
JOIN books USING(isbn)
WHERE isbn <ANY (SELECT isbn FROM orderitems
JOIN books USING(isbn)
WHERE customer# = 1001 OR customer# = 1005)); - CSELECT customer# FROM orders
JOIN books USING(isbn)
WHERE isbn = (SELECT isbn FROM orderitems
JOIN orders USING(order#)
WHERE customer# = 1001 OR 1005)); - DSELECT customer# FROM orders
JOIN orderitems USING(order#)
WHERE isbn IN (SELECT isbn FROM orders
JOIN orderitems USING(order#)
WHERE customer# IN (1001, 1005));
- ASELECT customer# FROM orders
150Which of the following operators is used to find all values greater than the highest value returned by a subquery?
- A>ALL
- B<ALL
- C>ANY
- D<ANY
- EIN
151Which query determines the customers who have ordered the most books from JustLee Books?
- ASELECT customer# FROM orders
JOIN orderitems USING(order#)
HAVING SUM(quantity) = (SELECT
MAX(SUM(quantity)) FROM orders
JOIN orderitems USING(order#)
GROUP BY customer#) GROUP BY customer#; - BSELECT customer# FROM orders
JOIN orderitems USING(order#)
WHERE SUM(quantity) = (SELECT
MAX(SUM(quantity)) FROM orderitems
GROUP BY customer#); - CSELECT customer# FROM orders
WHERE MAX(SUM(quantity)) = (SELECT
MAX(SUM(quantity) FROM orderitems
GROUP BY order#); - DSELECT customer# FROM orders
HAVING quantity = (SELECT MAX(SUM(quantity))
FROM orderitems
GROUP BY customer#);
- ASELECT customer# FROM orders
152Which of the following statements is correct?
- AThe IN comparison operator can't be used with a subquery that returns only one row of results.
- BThe equals (=) comparison operator can't be used with a subquery that returns more than one row of results.
- CIn an uncorrelated subquery, statements in the outer query are executed first, and then statements in the subquery are executed.
- DA subquery can be nested only in the outer query's SELECT clause.
153What is the purpose of the following query?
SELECT isbn, title FROM books
WHERE (pubid, category) IN (SELECT pubid, category
FROM books WHERE title LIKE '%ORACLE%');- AIt determines which publisher published a book belonging to the Oracle category and then lists all other books published by that same publisher.
- BIt lists all publishers and categories containing the value ORACLE.
- CIt lists the ISBN and title of all books belonging to the same category and having the same publisher as any book with the phrase ORACLE in its title.
- DNone of the above. The query contains a multiple-row operator, and because the inner query returns only one value, the SELECT statement will fail and return an error message.
154A subquery must be placed in the outer query's HAVING clause if:
- AThe inner query needs to reference the value returned to the outer query.
- BThe value returned by the inner query is to be compared to grouped data in the outer
query. - CThe subquery returns more than one value to the outer query.
- DNone of the above. Subqueries can't be used in the outer query's HAVING clause.
155Which of the following SQL statements lists all books written by the author of The Wok Way to Cook?
- ASELECT title FROM books
WHERE isbn IN (SELECT isbn FROM bookauthor
HAVING authorid IN 'THE WOK WAY TO COOK); - BSELECT isbn FROM bookauthor
WHERE authorid IN (SELECT authorid FROM books
JOIN bookauthor USING(isbn)
WHERE title = 'THE WOK WAY TO COOK'); - CSELECT title FROM bookauthor
WHERE authorid IN (SELECT authorid FROM books
JOIN bookauthor USING(isbn)
WHERE title = 'THE WOK WAY TO COOK); - DSELECT isbn FROM bookauthor
HAVING authorid = SELECT authorid FROM books
JOIN bookauthor USING(isbn)
WHERE title = 'THE WOK WAY TO COOK';
- ASELECT title FROM books
156Which of the following statements is correct?
- AIf the subquery returns only a NULL value, the only records returned by an outer query are those containing an equivalent NULL value.
- BA multiple-column subquery can be used only in the outer query's FROM clause.
- CA subquery can contain only one condition in its WHERE clause.
- DThe order of columns listed in the SELECT clause of a multiple-column subquery must be in the same order as the corresponding columns listed in the outer query's WHERE clause.
157In a MERGE statement, an INSERT is placed in which conditional clause?
- AUSING
- BWHEN MATCHED
- CWHEN NOT MATCHED
- DINSERTs aren't allowed in a MERGE statement.
158Given the following query, which statement is correct?
SELECT order# FROM orders
WHERE order# IN (SELECT order# FROM orderitems
WHERE isbn = '9959789321');- AThe statement doesn't execute because the subquery and outer query don't reference the same table.
- BThe outer query removes duplicates in the subquery's Order# list.
- CThe query fails if only one result is returned to the outer query because the outer query's WHERE clause uses the IN comparison operat
- DNo rows are displayed because the ISBN in the WHERE clause is enclosed in single quotation marks.
159Given the following SQL statement, which statement is most accurate?
SELECT customer# FROM customers
JOIN orders USING(customer#)
WHERE shipdate-orderdate IN
(SELECT MAX(shipdate-orderdate) FROM orders
WHERE shipdate IS NULL);- AThe SELECT statement fails and returns an Oracle error message.
- BThe outer query displays no rows in its results because the subquery passes a NULL value to the outer query
- CThe customer number is displayed for customers whose orders haven't yet shipped.
- DThe customer number of all customers who haven't placed an order are displayed.
160Which operator is used to process a correlated subquery?
- AEXISTS
- BIN
- CLINK
- DMERGE
161CREATE VIEW changeaddress
AS SELECT customer#, lastname, firstname, order#,
shipstreet, shipcity, shipstate, shipzip
FROM customers JOIN orders USING (customer#)
WHERE shipdate IS NULL
WITH CHECK OPTION;
Which of the following statements is correct?- ANo DML operations can be performed on the CHANGEADDRESS view.
- BThe CHANGEADDRESS view is a simple view.
- CThe CHANGEADDRESS view is a complex view.
- DThe CHANGEADDRESS view is an inline view.
162CREATE VIEW changeaddress
AS SELECT customer#, lastname, firstname, order#,
shipstreet, shipcity, shipstate, shipzip
FROM customers JOIN orders USING (customer#)
WHERE shipdate IS NULL
WITH CHECK OPTION;
Assuming there’s only a primary key, and FOREIGN KEY constraints exist on the underlying tables, which of the following commands returns an error message?- AUPDATE changeaddress
SET shipstreet = '958 ELM ROAD'
WHERE customer# = 1020; - BINSERT INTO changeaddress
VALUES (9999, 'LAST', 'FIRST', 9999,
'123 HERE AVE', 'MYTOWN', 'AA', 99999); - CDELETE FROM changeaddress
WHERE customer# = 1020; - Dall of the above
- Enone of the above
- AUPDATE changeaddress
163CREATE VIEW changeaddress
AS SELECT customer#, lastname, firstname, order#,
shipstreet, shipcity, shipstate, shipzip
FROM customers JOIN orders USING (customer#)
WHERE shipdate IS NULL
WITH CHECK OPTION;
Which of the following is the key-preserved table for the CHANGEADDRESS view?- ACUSTOMERS table
- BORDERS table
- CBoth tables together serve as a composite key-preserved table.
- Dnone of the above
164CREATE VIEW changeaddress
AS SELECT customer#, lastname, firstname, order#,
shipstreet, shipcity, shipstate, shipzip
FROM customers JOIN orders USING (customer#)
WHERE shipdate IS NULL
WITH CHECK OPTION;
Which of the following columns serves as the primary key for the CHANGEADDRESS view?- ACustomer#
- BLastname
- CFirstname
- DOrder#
- EShipstreet
165CREATE VIEW changeaddress
AS SELECT customer#, lastname, firstname, order#,
shipstreet, shipcity, shipstate, shipzip
FROM customers JOIN orders USING (customer#)
WHERE shipdate IS NULL
WITH CHECK OPTION;
If a record is deleted from the CHANGEADDRESS view based on the Customer# column, the customer information is then deleted from which underlying table?- ACUSTOMERS
- BORDERS
- CCUSTOMERS and ORDER
- DNeither—the DELETE command can’t be used on the CHANGEADDRESS view.
166CREATE VIEW changeaddress
AS SELECT customer#, lastname, firstname, order#,
shipstreet, shipcity, shipstate, shipzip
FROM customers JOIN orders USING (customer#)
WHERE shipdate IS NULL
WITH CHECK OPTION;
Which of the following is correct?- AROWNUM can’t be used with the view because it isn’t included in the results the subquery returns.
- BThe view is a simple view because it doesn’t include a group function or a GROUP BY clause.
- CThe data in the view can’t be displayed in descending order by customer number because an ORDER BY clause isn’t allowed when working with views.
- Dall of the above
- Enone of the above
167CREATE VIEW changeaddress
AS SELECT customer#, lastname, firstname, order#,
shipstreet, shipcity, shipstate, shipzip
FROM customers JOIN orders USING (customer#)
WHERE shipdate IS NULL
WITH CHECK OPTION;
Assuming one of the orders has shipped, which of the following is true?- AThe CHANGEADDRESS view can’t be used to update an order’s ship date because of the WITH CHECK OPTION constraint.
- BThe CHANGEADDRESS view can’t be used to update an order’s ship date because the Shipdate column isn’t included in the view.
- CThe CHANGEADDRESS view can’t be used to update an order’s ship date because the ORDERS table is not the key-preserved table.
- DThe CHANGEADDRESS view can’t be used to update an order’s ship date because the UPDATE command can’t be used on data in the view.
168CREATE VIEW changename
AS SELECT customer#, lastname, firstname
FROM customers
WITH CHECK OPTION;
Assume that the only constraint on the CUSTOMERS table is a PRIMARY KEY constraint.
Which of the following is a correct statement?- ANo DML operations can be performed on the CHANGENAME view.
- BThe CHANGENAME view is a simple view.
- CThe CHANGENAME view is a complex view.
- DThe CHANGENAME view is an inline view.
169CREATE VIEW changename
AS SELECT customer#, lastname, firstname
FROM customers
WITH CHECK OPTION;
Assume that the only constraint on the CUSTOMERS table is a PRIMARY KEY constraint.
Which of the following columns serves as the primary key for the CHANGENAME view?- ACustomer#
- BLastname
- CFirstname
- DThe view doesn’t have or need a primary key.
170CREATE VIEW changename
AS SELECT customer#, lastname, firstname
FROM customers
WITH CHECK OPTION;
Assume that the only constraint on the CUSTOMERS table is a PRIMARY KEY constraint.
Which of the following DML operations could never be used on the CHANGENAME view?- AINSERT
- BUPDATE
- CDELETE
- DAll of the above are valid DML operations for the CHANGENAME view
171CREATE VIEW changename
AS SELECT customer#, lastname, firstname
FROM customers
WITH CHECK OPTION;
Assume that the only constraint on the CUSTOMERS table is a PRIMARY KEY constraint.
The INSERT command can’t be used with the CHANGENAME view because:- AA key-preserved table isn’t included in the view.
- BThe view was created with the WITH CHECK OPTION constraint.
- CThe inserted record couldn’t be accessed by the view.
- DNone of the above—an INSERT command can be used on the table as long as the PRIMARY KEY constraint isn’t violated.
172CREATE VIEW changename
AS SELECT customer#, lastname, firstname
FROM customers
WITH CHECK OPTION;
Assume that the only constraint on the CUSTOMERS table is a PRIMARY KEY constraint.
If the CHANGENAME view needs to include the customer’s zip code as a means of verifying the change (that is, to authenticate the user), which of the following is true?- AThe CREATE OR REPLACE VIEW command can be used to re-create the view with the necessary column included in the new view.
- BThe ALTER VIEW . . . ADD COLUMN command can be used to add the necessary column to the existing view.
- CThe CHANGENAME view can be dropped, and then the CREATE VIEW command can be used to re-create the view with the necessary column included in the new view.
- DAll of the above can be performed to include the customer’s zip code in the view.
- EOnly (The CREATE OR REPLACE VIEW command can be used to re-create the view with the necessary column included in the new view.) and (The CHANGENAME view can be dropped, and then the CREATE VIEW command can be used to re-create the view with the necessary column included in the new view.) include the customer’s zip code in the view.
- FNone of the above includes the customer’s zip code in the view.
173Which of the following DML operations can’t be performed on a view containing a group function?
- AINSERT
- BUPDATE
- CDELETE
- DAll of the above can be performed on a view containing a group function
- ENone of the above can be performed on a view containing a group function.
174You can’t perform any DML operations on which of the following?
- Aviews created with the WITH READ ONLY option
- Bviews that include the DISTINCT keyword
- Cviews that include a GROUP BY clause
- DAll of the above allow DML operations.
- ENone of the above allow DML operations.
175A TOP-N analysis is performed by determining the rows with:
- Athe highest ROWNUM values
- Ba ROWNUM value greater than or equal to N
- Cthe lowest ROWNUM values
- Da ROWNUM value less than or equal to N
176To assign names to the columns in a view, you can do which of the following?
- AAssign aliases in the subquery, and the aliases are used for the column names.
- BUse the ALTER VIEW command to change column names.
- CAssign names for up to three columns in the CREATE VIEW clause before the subquery
is listed in the AS clause. - DNone of the above—columns can’t be assigned names for a view; they must keep their
original names.
177Which of the following is correct?
- AThe ORDER BY clause can’t be used in the subquery of a CREATE VIEW command.
- BThe ORDER BY clause can’t be used in an inline view.
- CThe DISTINCT keyword can’t be used in an inline view.
- DThe WITH READ ONLY option must be used with an inline view.
178If you try to add a row to a complex view that includes a GROUP BY clause, you get which of the following error messages?
- Avirtual column not allowed here
- Bdata manipulation operation not legal on this view
- Ccannot map to a column in a non-key-preserved table
- DNone of the above—no error message is returned.
179A simple view can contain which of the following?
- Adata from one or more tables
- Ban expression
- Ca GROUP BY clause for data retrieved from one table
- Dfive columns from one table
- Eall of the above
- Fnone of the above
180A complex view can contain which of the following?
- Adata from one or more tables
- Ban expression
- Ca GROUP BY clause for data retrieved from one table
- Dfive columns from one table
- Eall of the above
- Fnone of the above
Informações
- Descrição
- Computer Science Quiz sobre Midterm 2 (Chapter 5 - 13), criado por Yorria Raine em 29-03-2015.
- Autor
- Yorria Raine
- Idioma
- English
- Visualizações
- 793
- Etiquetas
- Avaliação
- Ainda sem avaliações Avalie este quiz