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




Theme © iAndrew 2016 - Forum software by © MyBB