Programming/SQL semantics discussion...

Programming/SQL semantics discussion. I'm working on a project where users can select traits and apply them to themselves (ex. I am funny). Users can also invent traits if they don't exist. (ex. I am funneriffic or some shit). Obviously the table for the traits that users apply to themselves would be labeled "traits" (an association of the user table and the trait catalog table), but the table that contains the "catalog" so to speak of traits would need to be called something different. I was thinking something like "trait entry" but I want it to be as clear as possible. What do you think, Sup Forums? Try not to redesign my implementation though, just talk about naming of the tables.

bumping with water cooling.

...

...

I don't understand why this needs a database, just a simple data structure like a linked list holding all the names.

Why do you need a separate table for a catalog of traits? That's the trait table already

If you store it in a linked list, you'll still need to pull the info from somewhere

It's a web app. I don't want to lose my data with one crash lol. Designed for longevity. That's the reason for a database.
The catalog of traits stores traits that others have predefined, and serves as a source from which autocomplete/algorithms can suggest traits. The trait table is just an association showing a user has a trait. Users have traits, traits link users to a trait catalog entry.

So you have a User table, a Traits table (the catalog), and a many-to-many-table linking Users to Traits? If so, this is the way you should have specified it

wow, that must make some pretty rad smoothies dude

The lights make it go faster

Yeah. I'm inexperienced with SQL terminology, I do apologize.

Oh but the issue is I'm trying to make this easy to understand for anyone who would want to look at the code. The reason why the association is called traits is because the association is what is displayed to the user as a "trait" that a user has, and so it makes sense for that to be called a trait. User has-many traits, but trait has-one "trait catalog entry" or something. I need a better name for "trait catalog entry". So i guess it would be a many to many to one.

Not at all, didn't realize you were experienced. But yeah, my suggestion should be what you need.

You could call the many to many (to people) table Users-Traits. If these other people are looking at the code, this is the basic setup for a m2m table

All your tables will now be named appropriately, your User table will contain a list of users. Your Traits table will contain a list of traits. Your Users-Traits table will show the links between Users and Traits

>experienced
Inexperienced I mean

I thought about naming the m2m table some sort of possessive. user_traits is not the worst semantically but the titles do seem a little too similar. An issue is those whose first language isn't english will be working with this code, and I want to make it easy on them.

Homie, this is literally the setup of m2m tables. In most frameworks that create tables for you, it's named that way (user_traits if traits is declared as a m2m relation on your user model). If they are going to code on this project, then they will be working on SQL and dealing with this standard SQL terminology. If they have SQL experience, they'll understand it easily as well

Ok I'll take that approach on your recommendation lol.

All things considered it does seem the most obvious choice, despite the name similarity. I guess the names are bound to be similar because the content is similar.

That's a simple Many to Many Relationship, you're describing here..

Traditionally, those are called the two tables they are linking together, i.e. when you have "people" and "traits" it would be: "people_traits".

Ah shit, didn't read that:

I've never had any formal education on sql which is why I didn't know that. Self taught has its limits after all. Thanks for the help guys.

We all start somewhere. I would definitely pick up learning RDBMS design/practices as well, in the event what you're doing expands