一、原题
The following data exists in the PRODUCTS table:
PROD_ID PROD_LIST_PRICE
123456 152525.99
You issue the following query:
SQL> SELECT RPAD(( ROUND(prod_list_price)), 10,'*')
FROM products
WHERE prod_id = 123456;
What would be the outcome?
A. 152526****
B. **152525.99
C. 152525** **
D. an error message
答案:A
二、题目翻译PROD_ID PROD_LIST_PRICE
123456 152525.99
You issue the following query:
SQL> SELECT RPAD(( ROUND(prod_list_price)), 10,'*')
FROM products
WHERE prod_id = 123456;
What would be the outcome?
A. 152526****
B. **152525.99
C. 152525** **
D. an error message
答案:A
下面是PRODUCTS表中的数据
执行下面的SQL查询语句
执行结果是什么?
三、题目解析执行下面的SQL查询语句
执行结果是什么?
表中 prod_list_price的值是152525.99,ROUND函数如果不写第二个参数,就是默认是0,保留到整数,
而ROUND四舍五入,所以ROUND(prod_list_price)=152526,
RPAD右填充函数,RPAD(( ROUND(prod_list_price)), 10,'*')表示,保留10个长度,如果不够,使用*填充,
所以RPAD(( ROUND(prod_list_price)), 10,'*')的结果为152526****
而ROUND四舍五入,所以ROUND(prod_list_price)=152526,
RPAD右填充函数,RPAD(( ROUND(prod_list_price)), 10,'*')表示,保留10个长度,如果不够,使用*填充,
所以RPAD(( ROUND(prod_list_price)), 10,'*')的结果为152526****