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

From: Tony Mountifield <tony_at_mountifield.org>
Date: Sat, 26 Oct 2019 22:24:33 +0000 (UTC)
Message-ID: <qp2h31$sit$1_at_softins.softins.co.uk>


In article <qp25f7$1jpd$1_at_gioia.aioe.org>, ^Bart <gabriele1NOSPAM_at_hotmail.com> wrote:
> Thanks for your reply! :)
>
> > Study this page until you understand MySQL data types. It sounds like
> > you do not, yet :-)
> >
> > https://www.w3schools.com/sql/sql_datatypes.asp
>
> I read it and I found important information about SQL data type I didn't
> know before but... tell me about this:
>
> id_user (BIGINT) FK_city (INT)
> ---------------------------------------
> 1 1
> 2 2
> ... ...
> 18446744073709551615 4294967295
>
> Should I set also FK_city like BIGINT?

[Quoted] Only if cities.id_city is a BIGINT. The type of id_user is irrelevant.

[Quoted] A FK data type must match the column it is referencing.

Cheers
Tony

-- 
Tony Mountifield
Work: tony_at_softins.co.uk - http://www.softins.co.uk
Play: tony_at_mountifield.org - http://tony.mountifield.org
Received on Sun Oct 27 2019 - 00:24:33 CEST

Original text of this message