OCP-1Z0-051-題目解析-第12題

來源:互聯網
上載者:User

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函數不可用於欄位名稱,是語法錯誤。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.