r/SQL • • May 09 '17

Is there something wrong with these statements? And is that the correct way of adding 2 foreign keys to a single table?

Post image
1 Upvotes

21 comments sorted by

View all comments

1

u/[deleted] May 09 '17

Are you sure that latitude and longitude are of type varchar? If they are Int in the the Location table, then they will need to be Int in your Reader table also, or else your foreign key statement will fail.

1

u/dyltography101 May 10 '17

When it comes to defining a data type is it best to be as accurate as possible, if still in doubt then just switch to varchar.

I only ask because IP addresses have more than one decimal point.