OCP-1Z0-051-名称解析-文章12称号

本文解析了如何通过SQL语句实现报表制作,包括字段标题的规范化和加双引号的使用规则,确保输出格式符合特定要求。

12. You need to produce a report where each customer's credit limit has been incremented by $1000. In
the output, the customer's last name should have the heading Name and the incremented credit limit
should be labeled New Credit Limit. The column headings should have only the first letter of each word in uppercase. 
Which statement would accomplish this requirement?

(题意:你须要制作一个报表,该表报中顾客的credit limit须要加1000,顾客名称字段的标题名称为Name。新credit limit的标题名称为 New Credit Limit,这三个单词要首字母大写。问以下的哪条语句符合上面的要求?)
A.
SELECT cust_last_name Name, cust_credit_limit + 1000 
"New Credit Limit" 
FROM customers;
B.
SELECT cust_last_name AS Name, cust_credit_limit + 1000 
AS New Credit Limit 
FROM customers;
C.
SELECT cust_last_name AS "Name", cust_credit_limit + 1000 
AS "New Credit Limit" 
FROM customers;
D.
SELECT INITCAP(cust_last_name) "Name", cust_credit_limit + 1000 
INITCAP("NEW CREDIT LIMIT") 
FROM customers;


Answer: B

题目解析:

这道题是关于字段标题是否加双引號的问题,关于双引號的使用规则例如以下:

1.假设字段名称是多个单词组成,中间有空格,如New Credit Limit。则必须加双引號,否则会报错。
2.假设标题名称是一个单词或多个连续的单词。假设不加双引號。则输出的格式是全然大写的,如选项A,就会输出NAME。
   假设加双引號则会原样输出,如选项C会输出 Name
综上所述,所以这道题的正确答案是C
D选项中的initcap函数不可用于字段名称。是语方法错误。

版权声明:本文博主原创文章。博客,未经同意不得转载。

转载于:https://www.cnblogs.com/yxwkf/p/4818468.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值