MySQL Forums
Forum List  »  General

Re: search for query that result one random url from domain
Posted by: laptop alias
Date: December 09, 2011 06:31AM

>its the length of the integer...
>is use it like a bool, where it is set to 1

Not exactly. Depending on the exact configuration, INT supports values in the range -2147483648 to 4294967295, i.e.INT(11). INT(100) is then a nonsense. In fact, defining the scale of INT at all only makes sense in the context of a ZEROFILL declaration, which can in any case be simulated through another process.

By way of illustration...


INSERT INTO my_ints VALUES (1,1),(2,2),(3,3),(1000,100000);

SELECT * FROM my_ints;
| i3   | i5     |
|  001 |  00001 |
|  002 |  00002 |
|  003 |  00003 |
| 1000 | 100000 |

Again, depending on configuration, TINYINT supports values in the range -128 to 255. As it only requires 1-byte storage (as opposed to the 4-byte storage of INT) it's a much better candidate for your bool.

Edited 1 time(s). Last edit at 12/09/2011 06:31AM by laptop alias.

Options: ReplyQuote

Written By
Re: search for query that result one random url from domain
December 09, 2011 06:31AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.