C. The EXPIRY_DATE column data type can be changed to TIMESTAMP.
This is true. In Oracle, you can modify the data type of a DATE column to a TIMESTAMP data type using the ALTER TABLE statement, as long as there are no incompatible data types involved.
D. The PROD_ID column can be renamed.
This is true. Oracle allows you to rename columns in a table using the ALTER TABLE statement with the RENAME COLUMN clause.
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)
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).
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"
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)
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Bissto
5 months agoogi33
9 months, 3 weeks agoUdhayapriya
1 year agoWingL
1 year, 6 months agoDarnun
1 year, 10 months agoalic_alex
1 year, 11 months agogreenneem
1 year, 11 months agoSantiBZ_07032022_1744
1 year, 11 months ago