[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Programming/SQL semantics discussion. I'm working on a project

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 21
Thread images: 5

File: compare.jpg (37KB, 1000x543px) Image search: [Google]
compare.jpg
37KB, 1000x543px
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, /g/? Try not to redesign my implementation though, just talk about naming of the tables.
>>
File: da0C5PZ.jpg (4MB, 6000x4000px) Image search: [Google]
da0C5PZ.jpg
4MB, 6000x4000px
bumping with water cooling.
>>
File: vuxRvRN.jpg (711KB, 2448x3264px) Image search: [Google]
vuxRvRN.jpg
711KB, 2448x3264px
>>
File: bDCCCRU.jpg (739KB, 2340x4160px) Image search: [Google]
bDCCCRU.jpg
739KB, 2340x4160px
>>
>>55668845
I don't understand why this needs a database, just a simple data structure like a linked list holding all the names.
>>
>>55668845
Why do you need a separate table for a catalog of traits? That's the trait table already

>>55668932
If you store it in a linked list, you'll still need to pull the info from somewhere
>>
>>55668932
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.
>>55668994
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.
>>
>>55669044
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
>>
>>55668922
wow, that must make some pretty rad smoothies dude
>>
>>55669093
The lights make it go faster

>>55669084
Yeah. I'm inexperienced with SQL terminology, I do apologize.
>>
>>55669084
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.
>>
>>55669109
Not at all, didn't realize you were experienced. But yeah, my suggestion should be what you need.

>>55669180
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
>>
>>55669212
>experienced
Inexperienced I mean
>>
>>55669212
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.
>>
>>55669269
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
>>
>>55669304
Ok I'll take that approach on your recommendation lol.
>>
>>55669304
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.
>>
File: ie.jpg (57KB, 640x755px) Image search: [Google]
ie.jpg
57KB, 640x755px
>>55668845

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".
>>
>>55669395

Ah shit, didn't read that: >>55669304
>>
>>55669418
>>55669304
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.
>>
>>55669601
We all start somewhere. I would definitely pick up learning RDBMS design/practices as well, in the event what you're doing expands
Thread posts: 21
Thread images: 5


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.