Topic: 1z0-071 topic 1 question 156

Examine the description of the PRODUCTS table which contains data:



Which two are true? (Choose two.)

A.
The PROD_NAME column cannot have a DEFAULT clause added to it.
B.
The EXPIRY_DATE column cannot be dropped.
C.
The EXPIRY_DATE column data type can be changed to TIMESTAMP.
D.
The PROD_ID column can be renamed.
E.
The PROD_ID column data type can be changed to VARCHAR2(2).

Re: 1z0-071 topic 1 question 156

ORA-01439: column to be modified must be empty to change datatype
D is ok cos the same group of datatype

Re: 1z0-071 topic 1 question 156

All are true for empty table
CREATE TABLE K (ID NUMBER(2) NOT NULL,NAME VARCHAR2(20),EXPIRY_dATE DATE NOT NULL)

ALTER TABLE K MODIFY NAME DEFAULT 'TEST'
ALTER TABLE K MODIFY EXPIRY_dATE TIMESTAMP
ALTER TABLE K RENAME COLUMN ID TO PROD_ID
ALTER TABLE K MODIFY PROD_ID VARCHAR2(2)

Re: 1z0-071 topic 1 question 156

100% C AND D
HAVE A TRY:
CREATE TABLE PRODUCTS_156
    (
    PROD_ID NUMBER(2) NOT NULL,
    PROD_NAME VARCHAR2(20),
    EXPIRY_DATE DATE
    );
INSERT INTO PRODUCTS_156
VALUES (1, 'Product 1', TO_DATE('2023-12-31', 'YYYY-MM-DD'));
ALTER TABLE PRODUCTS_156 MODIFY EXPIRY_DATE TIMESTAMP;
alter table products_156 rename column prod_id to product_id;
alter table products_156 modify product_id varchar(2);
(CHANGE DATA TYPE NOT ALLOWED WITH EXISTING DATA IN THE TABLE).

Re: 1z0-071 topic 1 question 156

CD is correct in that case

Re: 1z0-071 topic 1 question 156

in case of empty table correct will be C,E,D. But in case of existing data in the table correct will be C,D. Impossible to change datatype. System raise an error: "ORA-01439: column to be modified must be empty to change datatype"

Re: 1z0-071 topic 1 question 156

C works well when i run sql statement.

Re: 1z0-071 topic 1 question 156

drop table products_156;
CREATE TABLE PRODUCTS_156 (PROD_ID NUMBER(2) NOT NULL, PROD_NAME VARCHAR2(20), EXPIRY_DATE DATE);
ALTER TABLE PRODUCTS_156 MODIFY EXPIRY_DATE TIMESTAMP; /*C OK*/
alter table products_156 modify prod_id varchar(2);  /*E OK*/
alter table products_156 rename column prod_id to product_id; /*D OK*/
desc products_156;
Nombre      ¿Nulo?   Tipo         
----------- -------- ------------
PRODUCT_ID  NOT NULL VARCHAR2(2) 
PROD_NAME            VARCHAR2(20)
EXPIRY_DATE          TIMESTAMP(6)