Welcome Guest, Not a member yet? Register   Sign In
Avoid conflict between column names ?
#11

I think the best approach is with the table name on foreign keys and using SQL aliases for duplicated column names. Ex.:

Table user
col id
col name
col age
col company_id

Table company
col id
col name

For column alias
SELECT column_name AS alias_name
FROM table_name;

For table alias
SELECT column_1,column_2...
FROM table_name AS alias_name;

For more inputs check this out: https://www.scaler.com/topics/alias-in-sql/
Reply


Messages In This Thread
Avoid conflict between column names ? - by Coool6 - 11-07-2017, 12:38 AM
RE: Avoid conflict between column names ? - by soniajessica - 04-19-2022, 08:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB