Chinmayee Pdas
Chinmayee Pdas

Reputation: 155

Seperate fields for date and time in mysql

I am creating a table in mysql where I want to store 'date of birth' and 'time of birth' as 2 separate fields. What data types I have to use to create these 2 columns in mysql?

Upvotes: 1

Views: 40

Answers (1)

chacid
chacid

Reputation: 35

There are two data types DATE and Time that will help you. Here is an example:

   CREATE TABLE table (
    id INT PRIMARY KEY AUTO_INCREMENT,
    birth_date DATE,
    birth_time TIME
    );

Upvotes: 1

Related Questions