user3847554
user3847554

Reputation: 3

trying to change a data type in table using a query

I have this query

CREATE TABLE COSTUMER(
    COSTUMER_ID INT,
    TAXI_ID INT,
    COSTUMER_PHONE_NUMBER BIGINT,
    COSTUMER_NAME VARCHAR(40),
    DESTINATION VARCHAR(40)
);

i'd like to change the DESTINATION data type to DATETIME rather than VARCHAR. or if you can suggest a better data type that can store a full address the please do.

I tried this query

ALTER TABLE COSTUMER ALTER DESTINATION DATETIME

but when executed I get this message :

102 stating expecting column

Upvotes: 0

Views: 47

Answers (2)

sun_dare
sun_dare

Reputation: 1166

 ALTER TABLE COSTUMER MODIFY COLUMN DESTINATION DATETIME;

Upvotes: 0

Jigesh Patadia
Jigesh Patadia

Reputation: 11

If it is a mySql database then the syntax should be as follows:

ALTER TABLE table_name MODIFY COLUMN column_name datatype

Upvotes: 1

Related Questions