mysql - Simple creation of table and inserting value to it -


i want create table in mysql has column time


value time column must accept 9am 10pm

+-----------------------------+ | date                        | +-----------------------------+ | 9am 10pm                 | +-----------------------------+ 
  • which datatype should use ?
  • if don't want use varcar & if can use time data-type- how represent values there ?
  • i looking create table , insert statement answer above specifications ?

i newbie please go easy answers

thanks !

as suggested above in comment table structure be:

create table yourtable ( fromtime time, totime time ) 

now insert values below:

insert yourtable values(time(str_to_date('09:00 am', '%h:%i %p')),time(str_to_date('10:00 pm', '%h:%i %p'))) 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -