Re: Newbie question about BIGINT and INT in the same table

From: The Natural Philosopher <tnp_at_invalid.invalid>
Date: Sun, 27 Oct 2019 08:14:24 +0000
Message-ID: <qp3jl0$fkf$1_at_dont-email.me>


On 27/10/2019 08:05, ^Bart wrote:

>> Only if cities.id_city is a BIGINT. The type of id_user is irrelevant.

>
> If I have something like this:
>
> id_user (BIGINT)         age (INT)
> ---------------------------------------
> 1                    1
> 2                     2
> ...                 ...
> 18446744073709551615    4294967295
>
> Should be the field age BIGINT like id_user? Should they have the same
> lenght (both INT or both BIGINT)?
>
> When I add the user 4294967296 it will not be able to add a value in age
> field because 4294967296 is over quota of INT but it's available for
> BIGINT...
>
>> A FK data type must match the column it is referencing.

>
> Yes, I know it, it was the first error I made when I started to create a
> DB (lol! :D).
>
>> Cheers
>> Tony

>
> Regards.
> ^Bart
>

[Quoted] You use the size of variable you need. if the values in the age column are really going to exceed the time to the heat death of the universe, use a bigint
-- 
If you tell a lie big enough and keep repeating it, people will 
eventually come to believe it. The lie can be maintained only for such 
time as the State can shield the people from the political, economic 
and/or military consequences of the lie. It thus becomes vitally 
important for the State to use all of its powers to repress dissent, for 
the truth is the mortal enemy of the lie, and thus by extension, the 
truth is the greatest enemy of the State.

Joseph Goebbels
Received on Sun Oct 27 2019 - 09:14:24 CET

Original text of this message