62 Click the Exhibit button and examine the data from the ORDERS and
CUSTOMERS tables.
Evaluate the SQL statement:
SELECT *
FROM orders
WHERE cust_id = (SELECT cust_id
FROM customers
WHERE cust_name = 'Smith');
What is the result when the query is executed?
Answer: A该问题应该不是选择D嘛,SELECT cust_id FROM customers WHERE cust_name = 'Smith'选择的是多个值了使用=号不就报错了呀
CUSTOMERS tables.
Evaluate the SQL statement:
SELECT *
FROM orders
WHERE cust_id = (SELECT cust_id
FROM customers
WHERE cust_name = 'Smith');
What is the result when the query is executed?
Answer: A该问题应该不是选择D嘛,SELECT cust_id FROM customers WHERE cust_name = 'Smith'选择的是多个值了使用=号不就报错了呀
解决方案 »
- 正则表达式问题!
- 内嵌SQL的一些用法
- 用jsp实现用户登陆
- 有关schema独占访问的问题。
- oracle高手进来指点一二啊,很简单的问题
- 关于sqlplus的问题
- TNS-12518: TNS:listener could not hand off client connection
- 在oracle中创建表空间为什么失败?
- 使用sql语句新建oracle数据库怎样指定数据库的用户和及其对应的用户密码呢?
- 这个sqlserver的存储过程如何改成ORACLE的???
- oracle10g system 远程登录提示insufficient privileges,怎么回事?
- oracle 11g 自己建立的listener跟OWB
估计出题人想考的是子查询,他的理想答案应当是oraders表中smith关联的所有记录。
只能说这道题不够严谨,在cust_name有唯一索引的情况下SQL是正确的,否则有可能出错。
CUSTOMERS tables.
Evaluate the SQL statement:
SELECT *
FROM orders
WHERE cust_id = (SELECT cust_id
FROM customers
WHERE cust_name = 'Smith');
What is the result when the query is executed? ORDERS
ORD_ID ORD_DATE CUST_ID ORD_TOTAL
100 2000/1/12 15 10000
101 2000/1/13 40 8000
102 2000/1/14 35 12500
103 2000/1/15 15 12000
104 2000/1/16 15 6000
105 2000/1/17 20 5000
106 2000/1/18 35 7000
107 2000/1/19 20 6500
108 2000/1/20 10 8000
CUSTOMERS
CUST_ID CUST_NAME CITY
10 Smith los angeles
15 Bob san francisco
20 Martin chicago
25 mary new york
30 Rina chicago
35 Smith new york
40 Linda new york
A.ORD_ID ORD_DATE CUST_ID ORD_TOTAL
102 2000/1/14 35 12500
106 2000/1/18 35 7000
108 2000/1/20 10 8000
B.ORD_ID ORD_DATE CUST_ID ORD_TOTAL
102 2000/1/14 35 12500
106 2000/1/18 35 7000
C.ORD_ID ORD_DATE CUST_ID ORD_TOTAL
108 2000/1/20 10 8000
D.The query fails because the subquery returns more than one row.
E.The query fails because the outer query and the inner query are using different tables.
我把它手key了下来,帮忙分析下哈