Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why Are There Duplicate Data Types 1

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
New to MySql. Why are there two datetime data types as well as duplicates of other types when you are adding a column? Are they different?

Auguy
Sylvania/Toledo Ohio
 
OK, But I see a DateTime in a group at the top and another DateTime further down the list when I click the down arrow of the combo box for data types. Just wondering why there are two entries.

Auguy
Sylvania/Toledo Ohio
 
at the top and further down" of WHAT exactly????

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
When I'm altering the table and I click the combo box in the Data Type column I get a list of several groups of data types separated by a line with only a dash. In that list several of the types are listed more than once.

Auguy
Sylvania/Toledo Ohio
 
Oh dear deity! It's like pulling teeth!!!!

MySQL does NOT HAVE A "Combo Box" it has a command line and that's ALL.






Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Sorry, I'm using the workbench to create and alter the tables.

Auguy
Sylvania/Toledo Ohio
 
The workbench" being????

You need to remember that most TT members answering question do not use ANY WYSIWYG 'tools' for working with MySQL, so we have no idea what "the workbench" is, other than something that occupies a chunk of space in the garage.

So I am going to take a guess.

The "one at the top" is what the column is currently set to, and "the one further down" is the result of a lazy programmer just listing ALL the possibles values and neglecting to omit the one already set.



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
I believe the OP is talking about the MYSQL Workbench. which some actually do use.

In any case, the Date, DateTime, and Timestamp datatypes each hold the information a little differently.

You may want to take a look at the MYSQL manual, and the specific entry for Date datatypes.


The DATE type is used for values with a date part but no time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31'.

The DATETIME type is used for values that contain both date and time parts. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.

The TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
I believe the OP is talking about the MYSQL Workbench. which some actually do use.

Sure, some may, I can't say I have ever used it or even knew of it's existence until the few seconds before posting this reply. The last tool I used for MySQL was "HeidiSQL" and it has been a long time since I had that installed let alone used.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Oh Phil, assuming you do use it, .. How close was my guess?? :)

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
OK, I know the differences between the date, datetime, etc types. My question is why are some of the EXACT same types listed more than once in the Workbench drop down for data type?

Auguy
Sylvania/Toledo Ohio
 
My question is why are some of the EXACT same types listed more than once in the Workbench drop down for data type?

No idea, ... but have a look at my guess in post six and then check other columns with different types to see if the supposition holds true for all data types.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Oh Phil, assuming you do use it, .. How close was my guess?? :)
Well... uh... I don't really use Workbench. but I do have it installed.

And looking into it... Not too far off.
I can see, when altering a table the datatypes are grouped. The first one is the one currently selected, second is the set of what I can only assume are most used Datatypes.Int, Varchar, Datetime etc...

Then come the binary and blob types. Followed by the datetime group. I can see the Datetime type (twice) 3 times if you count the one currently set. But its clear from the grouping why it exists twice in the listings. Once in the most used Group and a second time in the Date/Time group.

Other types also appear more than once. But usually only if they appear in the first group. will they appear again.

datatypedropdown_zps502fb7a0.png










----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Thanks Phil, that explains it.

Auguy
Sylvania/Toledo Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top