86. Examine the structure and data of the CUST_TRANS table:
下面是CUST_TRANS的表结构和表中的数据
CUST_TRANS
Name Null Type
CUSTNO NOT NULL CHAR(2)
TRANSDATE DATE
TRANSAMT NUMBER(6,2)
CUSTNO TRANSDATE TRANSAMT
11 01-JAN-07 100022 01-FEB-07 2000
33 01-MAR-07 3000
Dates are stored in the default date format dd-mon-rr in the CUST_TRANS table. Which SQL statements would execute successfully? (Choose three .)
表中的日期使用了默认的日期格式 dd-mon-rr ,下面那些个语句是可以执行成功的。(选择3个)
B. SELECT * FROM cust_trans WHERE transdate = '01-01-07';
C. SELECT transamt FROM cust_trans WHERE custno > '11';
D. SELECT * FROM cust_trans WHERE transdate='01-JANUARY-07';
E. SELECT custno + 'A' FROM cust_trans WHERE transamt > 2000;
答案:ACD
B:日期格式不一致,不能隐式转换,需要使用to_date
E:A是字符,发生隐式转换时不能转换为数字,会报错
本文通过一个具体的例子,展示了如何在Oracle数据库中使用SQL语句进行数据查询。包括日期格式的匹配、数值比较等实用技巧。
1万+

被折叠的 条评论
为什么被折叠?



