QUESTION 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")
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;
答案:C
解析:
SQL> create table customers (
2 cust_last_name varchar2(10) not null,
3 cust_credit_limit number not null);
表已创建。
SQL> insert into customers values('test',100);
已创建 1 行。
SQL> --A选项可以执行,但Name没有正确显示。
SQL> SELECT cust_last_name Name, cust_credit_limit + 1000
2 "New Credit Limit"
3 FROM customers;
NAME New Credit Limit
---------- ----------------
test 1100
--B选项报错。
SQL> SELECT cust_last_name AS Name, cust_credit_limit + 1000
2 AS New Credit Limit
3 FROM customers;
AS New Credit Limit
*
第 2 行出现错误:
ORA-00923: 未找到要求的 FROM 关键字
--C选项正确显示。
SQL> SELECT cust_last_name AS "Name", cust_credit_limit + 1000
2 AS "New Credit Limit"
3 FROM customers;
Name New Credit Limit
---------- ----------------
test 1100
--D选项报错。
SQL> SELECT INITCAP(cust_last_name) "Name", cust_credit_limit + 1000 INITCAP("NE
W CREDIT LIMIT")
2 FROM customers;
SELECT INITCAP(cust_last_name) "Name", cust_credit_limit + 1000 INITCAP("NEW CRE
DIT LIMIT")
*
第 1 行出现错误:
ORA-00923: 未找到要求的 FROM 关键字