12. You need to produce a report where each customer's credit limit has been incremented by $1000. In
the output, t he 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?
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;
如果不加引号,返回的列标题都是大写,A不对
列名如果包含空格,必须要用双引号,B不对
列名不能使用函数 D不对(这一选项似乎是个坑)。
the output, t he 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?
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;
如果不加引号,返回的列标题都是大写,A不对
列名如果包含空格,必须要用双引号,B不对
列名不能使用函数 D不对(这一选项似乎是个坑)。
SQL> SELECT cust_last_name NAME, cust_credit_limit + 1000 "New Credit Limit"
2 FROM sh.customers
3 WHERE rownum <= 1;
NAME New Credit Limit
---------------------------------------- ----------------
Ruddy 2500
SELECT cust_last_name AS NAME, cust_credit_limit + 1000 AS NEW credit LIMIT
FROM sh.customers
WHERE rownum <= 1
ORA-00923: 未找到要求的 FROM 关键字
SQL> SELECT cust_last_name AS "Name",
2 cust_credit_limit + 1000 AS "New Credit Limit"
3 FROM sh.customers
4 WHERE rownum <= 1;
Name New Credit Limit
---------------------------------------- ----------------
Ruddy 2500
SELECT initcap(cust_last_name) "Name",
cust_credit_limit + 1000 initcap("NEW CREDIT LIMIT")
FROM sh.customers
WHERE rownum <= 1
ORA-00923: 未找到要求的 FROM 关键字
SQL>
Answer: C