Which statements are true regarding the creation and storage of data in the above table structure?

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 CHAR
TRANS_DATE NOT NULL DATE
TRANS_VALIDITY VARCHAR2
CUST_CREDIT_LIMIT NUMBER
Which statements are true regarding the creation and storage of data in the above table structure? (Choose
all that apply.)

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 CHAR
TRANS_DATE NOT NULL DATE
TRANS_VALIDITY VARCHAR2
CUST_CREDIT_LIMIT NUMBER
Which statements are true regarding the creation and storage of data in the above table structure? (Choose
all that apply.)

A.
The CUST_STATUS column would give an error.

B.
The TRANS_VALIDITY column would give an error.

C.
The CUST_STATUS column would store exactly one character.

D.
The CUST_CREDIT_LIMIT column would not be able to store decimal values.

E.
The TRANS_VALIDITY column would have a maximum size of one character.

F.
The TRANS_DATE column would be able to store day, month, century, year, hour, minutes, seconds, and fractions of seconds.



Leave a Reply 15

Your email address will not be published. Required fields are marked *


arya

arya

Can anybody explain why the option B is correct?

ser

ser

You need to specify a maximum string length for varchar2(varchar2(3999), fe.)

Mike

Mike

Please explain on option E, why isn’t it correct?

Justyna

Justyna

When you define a column of type Varchar2 you need to specify the length. The minimal is 1. That is why B is correct.

user

user

thanks Justyna

user

user

sorry I meant option F.

The TRANS_DATE column would be able to store day, month, century, year, hour, minutes, seconds, and fractions of seconds.

Why is option F incorrect? Per Oracle: DATE datatype stores the year (including the century), the month, the day, the hours, the minutes, and the seconds (after midnight).

Justyna

Justyna

TRANS_DATE is of type Date so cannot store fractions of seconds

user

user

C is not correct: The CUST_STATUS column would store exactly one character.

The length of CHAR was not specified. It is incorrect.

Justyna

Justyna

For CHAR datatype default length is 1 and you do not need to specify it.

eva

eva

B and C are correct because

B reason:When you create a table with a VARCHAR2 column, you specify a maximum string length (in bytes or characters) between 1 and 4000 bytes for the VARCHAR2 column

C reason:When you create a table with a CHAR column, you must specify a string length (in bytes or characters) between 1 and 2000 bytes for the CHAR column width. The default is 1 byte.

eJossue

eJossue

Option A should be correct. You cannot specify NOT NULL before the data type for a column.

donald

donald

A is correct! The CUST_STATUS column will give error. Must state colName dataType Not Null (if required). The first attribute is colName, the second Must be dataType.
B is correct! The TRANS_VALIDITY VARCHAR2, will give error because MUST DEFINE length eg. VARCHAR2(10), or any integer inside parenthesis.
C is INCORRECT! The CUST_STATUS column would store exactly one character. Only if you switch NOT NULL and CHAR around.
This is wrong: CUST_STATUS NOT NULL CHAR
This is right: CUST_STATUS CHAR NOT NULL. And NO you do not need to define length. It will default to 1. NOT LIKE VARCHAR2…. it requires parenthesis with an integer inside.
D is wrong! Number can store decimals even without stating number(4, 2) for example.
E is wrong! TRANS_VALIDITY VARCHAR2 results in error as explained above. MUST define length.
F is wrong! TRANS_DATE NOT NULL DATE fails for TWO reasons. First NOT NULL must come after data type (DATE) and fractions of seconds are only available with timestamp datatypes.
VERY POORLY WRITTEN QUESTION!
THerefore,
TRANS_ID NOT NULL NUMBER(6) will give error
CUST_NAME NOT NULL VARCHAR2(20) will give error
CUST_STATUS NOT NULL CHAR will give error
TRANS_DATE NOT NULL DATE will give error

trail

trail

@donald : It’s description of table. try Desc emp; You ll see how table is described in oracle. I’ just how table structure is described.
B & C is correct Answer.

trail

trail

@donald : It’s description of table. try Desc emp; You ll see how table is described in oracle.
B & C is correct Answer.