遇到的题目如下:The CUSTOMERS table has these columns:CUSTOMER_ID NUMBER(4) NOT NULLCUSTOMER_NAME VARCHAR2(100) NOT NULLCUSTOMER_ADDRESS VARCHAR2(150)CUSTOMER_PHONE VARCHAR2(20)You need to produce output that states "Dear Customer customer_na
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 06:20:53
遇到的题目如下:The CUSTOMERS table has these columns:CUSTOMER_ID NUMBER(4) NOT NULLCUSTOMER_NAME VARCHAR2(100) NOT NULLCUSTOMER_ADDRESS VARCHAR2(150)CUSTOMER_PHONE VARCHAR2(20)You need to produce output that states "Dear Customer customer_na
遇到的题目如下:
The CUSTOMERS table has these columns:
CUSTOMER_ID NUMBER(4) NOT NULL
CUSTOMER_NAME VARCHAR2(100) NOT NULL
CUSTOMER_ADDRESS VARCHAR2(150)
CUSTOMER_PHONE VARCHAR2(20)
You need to produce output that states "Dear Customer customer_name,".The customer_name data
values come from the CUSTOMER_NAME column in the CUSTOMERS table.Which statement
produces this output?
我看不懂它的答案:
D.SELECT 'Dear Customer ' || customer_name || ','
FROM customers;
这表示Dear Customer和 customer_name还有一个逗号表示什么?
遇到的题目如下:The CUSTOMERS table has these columns:CUSTOMER_ID NUMBER(4) NOT NULLCUSTOMER_NAME VARCHAR2(100) NOT NULLCUSTOMER_ADDRESS VARCHAR2(150)CUSTOMER_PHONE VARCHAR2(20)You need to produce output that states "Dear Customer customer_na
这不是要求的输出格式么?
You need to produce output that states "Dear Customer customer_name,".The customer_name data
要求输出格式:"Dear Customer customer_name,".把customer_name换成表中customer_name字段的值.
SELECT 'Dear Customer ' || customer_name || ',' FROM customers
这个语法,逗号在单引号中了,所以这是字符串的一部分,不是查询语句的符号,所以不用在意,只是为了按照要求的格式进行输出.要求的格式最后是有一个逗号的,这个逗号就是那个.
'Dear Customer ' || customer_name || ',' ----------这就是输出的内容
ORACLE中||是字符串连接赋,实现把||符号左右两侧的字符串连接起来.
所以这个语句,根据||,需要您分成三部分看:
第一部分'Dear Customer ' ,两个单引号引着,是固定的字符串.
第二部分customer_name ,这个是表中字段的值
第三部分',' ,又是一个固定的字符串.
假设表中有如下几个数据,我们只看CUSTOMER_NAME字段
COSTOMER_NAME
test1
test2
test1
那么这个结果就是
Dear Customer test1,
Dear Customer test2,
Dear Customer test3,
这个是应该是在ORACLE数据库里面查询的一个结果,D. SELECT 'Dear Customer ' || customer_name || ',' FROM customers是为了满足题目的条件,输出格式为"Dear Customer customer_name, "的结果(最后的结果里面有一个逗号,"||" 为ORACLE 中字符串拼接的符号,相当于SQLSERVER中的"+")...
全部展开
这个是应该是在ORACLE数据库里面查询的一个结果,D. SELECT 'Dear Customer ' || customer_name || ',' FROM customers是为了满足题目的条件,输出格式为"Dear Customer customer_name, "的结果(最后的结果里面有一个逗号,"||" 为ORACLE 中字符串拼接的符号,相当于SQLSERVER中的"+")
收起