1Z0-051 QUESTION 24 数据类型应该注意的地方

来源:互联网 发布:流体计算软件app 编辑:程序博客网 时间:2024/05/22 10:36
QUESTION 24
Examine the structure proposed for the TRANSACTIONS table:
name Null Type
TRANS_ID NOT NULL NUMBER(6)
CUST_NAME NOT NULL VARCHAR2(20)
CUST_STATUS NOT NULL VARCHAR2
TRANS_DATE NOT NULL DATE
TRANS_VALIDITY INTERVAL DAY TO SECOND
CUST_CREDIT_VALUE NUMBER(10)
Which two statements are true regarding the storage of data in the above table structure? (Choose two.)
A. The TRANS_DATE column would allow storage of dates only in the dd-mon-yyyy format.
B. The CUST_CREDIT_VALUE column would allow storage of positive and negative integers.
C. The TRANS_VALIDITY column would allow storage of a time interval in days, hours, minutes, and
seconds.
D. The CUST_STATUS column would allow storage of data up to the maximum VARCHAR2 size of 4,000

characters.

答案:BC

解析:

A选项错,TRANS_DATE 为DATE数据类型,不单单可以存储dd-mon-yyyy的类型,参看如下官方文档:

http://docs.oracle.com/cd/E11882_01/server.112/e40540/tablecls.htm#CNCPT413

Dates are stored in fixed-length fields of 7 bytes each, corresponding to century, year, month, day, hour, minute, and second.

B选项正确,CUST_CREDIT_VALUE为NUMBER(10),可以存储正数和负数,参看如下官方文档:

http://docs.oracle.com/cd/E11882_01/server.112/e40540/tablecls.htm#CNCPT1832

The NUMBER data type stores fixed and floating-point numbers. The database can store numbers of virtually any magnitude. This data is guaranteed to be portable among different operating systems running Oracle Database. The NUMBER data type is recommended for most cases in which you must store numeric data.

C选项正确,TRANS_VALIDITY为INTERVAL DAY TO SECOND,从日精确到秒,因此,可以存储 days, hours, minutes, and seconds.

D选项不正确, CUST_STATUS,指定的类型VARCHAR2没有精度,会报错。

0 0