SELECTstatement, not in subqueries.
当然提交或者回滚将释放该锁
158. Which statementsare true regarding the FOR UPDATE clause in a SELECT statement (Choose all
that apply.)
A. It locks only thecolumns specified in the SELECT list.
B. It locks the rowsthat satisfy the condition in the SELECT statement.
C. It can be used only inSELECT statements that are based on a single table.
D. It can be used inSELECT statements that are based on a single or multiple tables.
E. After it is enforcedby a SELECT statement, no other query can access the same rows until a
COMMIT or ROLLBACK isissued.
Answer: BD
解析:
同上题
159. View the Exhibitand examine the structure of the CUSTOMERS table.
NEW_CUSTOMERS is a newtable with the columns CUST_ID, CUST_NAME and CUST_CITY that
have the same data typesand size as the corresponding columns in the CUSTOMERS table.
eva luate the followingINSERT statement:
INSERT INTOnew_customers (cust_id, cust_name, cust_city)
VALUES(SELECTcust_id,cust_first_name' 'cust_last_name,cust_city
FROM customers
WHERE cust_id >23004);
The INSERT statementfails when executed. What could be the reason

A. The VALUES clausecannot be used in an INSERT with a subquery.
B. Column names in theNEW_CUSTOMERS and CUSTOMERS tables do not match.
C. The WHERE clausecannot be used in a subquery embedded in an INSERT statement.
D. The total number ofcolumns in the NEW_CUSTOMERS table does not match the total number of
columns in the CUSTOMERStable.
Answer: A
解析:
这里不能用子查询的结果插入的到表中
160. View the Exhibitand examine the structure of ORDERS and CUSTOMERS tables.
There is only one customerwith the cust_last_name column having value Roberts. Which INSERT
statement should be usedto add a row into the ORDERS table for the customer whose
CUST_LAST_NAME isRoberts and CREDIT_LIMIT is 600

A. INSERT INTO orders
VALUES (1,'10-mar-2007','direct',
(SELECT customer_id
FROM customers
WHEREcust_last_name='Roberts' AND
credit_limit=600),1000);
B. INSERT INTO orders(order_id,order_date,order_mode,
(SELECT customer_id
FROM customers
WHEREcust_last_name='Roberts' AND
credit_limit=600),order_total)
VALUES(1,'10-mar-2007','direct', &&customer_id, 1000);
C. INSERT INTO(SELECTo.order_id, o.order_date,o.order_mode,c.customer_id, o.order_total
FROM orders o, customersc
WHERE o.customer_id =c.customer_id
ANDc.cust_last_name='Roberts' ANDc.credit_limit=600 )
VALUES (1,'10-mar-2007','direct',(SELECT customer_id
FROM customers
WHEREcust_last_name='Roberts' AND
credit_limit=600),1000);
D. INSERT INTO orders(order_id,order_date,order_mode,
(SELECT customer_id
FROM customers
WHERE cust_last_name='Roberts'AND
credit_limit=600),order_total)
VALUES(1,'10-mar-2007','direct', &customer_id, 1000);
Answer: A
解析:
A选项中
INSERT INTO orders
VALUES (1,'10-mar-2007','direct',
(SELECTcustomer_id
FROM customers
WHEREcust_last_name='Roberts' AND
credit_limit=600), 1000);
这里将(SELECTcustomer_id
FROM customers
WHEREcust_last_name='Roberts' AND
credit_limit=600)得到的结果作为相应列插入到orders表中
161. View the exhibitand examine the description for the SALES and CHANNELS tables.
You issued the followingSQL statement to insert a row in the SALES table:
INSERT INTO sales VALUES
(23, 2300, SYSDATE,(SELECT channel_id
FROM channels
WHEREchannel_desc='Direct Sales'), 12, 1, 500);
Which statement is trueregarding the execution of the above statement

A. The statement wil