0

I'm building a relational database, and so many of my tables have 'name' columns. And they're all related to each other.

For example, a central column is the Client table, and the client can have multiple Customers, and each client has a name, and each customer has a name. And each customer will be subscribed to any number of Services, which also has a name.

So I can have a 'name' column on every table, or alternatively I can have 'client_name', 'customer_name', 'service_name' and so on. Which hypothetically would make joins easier.

What do you recommend?

TKoL
  • 13,158
  • 3
  • 39
  • 73
  • Possible duplicate of [Naming of ID columns in database tables](https://stackoverflow.com/questions/208580/naming-of-id-columns-in-database-tables) – philipxy Sep 30 '19 at 09:44
  • This is a faq. Before considering posting please always google your error message or many clear, concise & precise phrasings of your question/problem/goal, with & without your particular strings/names & site:stackoverflow.com & tags, & read many answers. If you post a question, use one phrasing as title. See [ask] & the voting arrow mouseover texts. – philipxy Sep 30 '19 at 09:45

1 Answers1

3

When you go to join two or more of these tables, you can (and probably should) use table aliases when referring to the individual columns. So, there is no chance anyway of the column name on one table being confounded with name from another table. That being said, I also recommend using the shorter version because it makes the labelling of each individual table more concise and readable. Calling a column in the client table client_name is redundant, and doesn't add any useful information.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360