New to Oracle SQL and I assume that this is a very straight forward question but I can’t find a direct answer. I have an employees table in my database. One of the columns is ’emp_state’ which is to show the State in which the employee resides. I also have a ‘Customer’ table and an ‘office’ table, which also both have a ‘State’ field. To reduce the amount of redundant data in my database, I have created a ‘State’ table, which will have all the states with a corresponding ID. I want to reference this table in the other tables as mentioned. When setting up my table, what should I define as the foreign key in the relevant tables? Should it be ‘State_id’ or ‘State_name’? I want the state name to appear in any queries that are run, rather than the state ID which would be meaningless to a user.
Thank you!
joinon aINTthen aVARCHAR.JOINon the table and get itSo bottom line: Always use the id