Questions on MySQL datatype.

Hello,

I'm creating my frist table using MySQL and have these questions:

1) I cannot find a datatype such as BOOL or Boolean so should I go with BIT? (for true/false values)
2) I need to save the date and time of a message either during a send or receiving process. Should I use DATE and TIME or DATESTAMP and TIMESTAMP?
3) What format will be picked by default for time and date? can I specify them? any example?
4) In SQL-Server, I usually had to use a GUI environment to create the relationship among tables, how can  I do this in MySQL in command line? any reference that I can use to learn?

Regards,
ak





Solution: Questions on MySQL datatype.


1) I cannot find a datatype such as BOOL or Boolean so should I go with BIT? (for true/false values)

BOOL in MySQL is a synonym for CHAR(1). 1 being true and 0 being false. I use a tool to do database design and this is what it tells me about bool. Also the documentation for MySQL said the same the last time I read it.

Mysql Docs: http://dev.mysql.com/doc/
Mysql Datatypes: http://dev.mysql.com/doc/refman/5.0/en/data-types.html
DBDesigner4: http://fabforce.net/dbdesigner4/

2) I need to save the date and time of a message either during a send or receiving process. Should I use DATE and TIME or DATESTAMP and TIMESTAMP?

I generally user DATETIME for this

3) What format will be picked by default for time and date? can I specify them? any example?

DATETIME format is : YYYY-MM-DD HH:MM:SS

4) In SQL-Server, I usually had to use a GUI environment to create the relationship among tables, how can  I do this in MySQL in command line? any reference that I can use to learn?

I generally keep track of these relationships programatically (SP) and to be honest I cant say if MySQL can do so or not. According to this page MySQL does the hard work on InnoDB tables (which you will also need if you plan on using transactions.

http://dev.mysql.com/doc/workbench/en/wb-foreign-key-relationships.html