[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/wsr/ - Worksafe Requests

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


🎉 Happy Birthday 4chan! 🎉


[Advertise on 4chan]


File: squole.jpg (14 KB, 463x463)
14 KB
14 KB JPG
>programming and database stuff
I have an idea for a site I want to make (to learn, and to maintain as a hobby!), but I'm not sure what I should be searching for. I have some basic knowledge of some programming languages, and some other markup languages and a very faint gist of sql (mysql?).

I know roughly which databases and tables I'd need to set up for my project, but I have issues searching up information on how to implement a tag-like system. As an example, imagine I want to make a database of "restaurants" in my town, and pre-approved users will be able to add their own "reviews", marking the various cuisines were to find on the menu as well as the vibes of the place (predefined "tags"). The users may also choose to make some of their tags prominent, adding extra weight when calculating its average.

For example, Annie and Buford have visited the restaurant Heart of India, and would like to review it for the catalogue!
>Annie checks off Indian, Vegetarian, and Spicy cuisine tags, as well as Warm, and Relaxed atmosphere. Annie marks Indian and Warm as prominent.
>Buford checks off Indian, Spicy, and Relaxed. He marks Spicy as prominent.
>Combining the two, Heart of India is tagged as Indian, Vegetarian, Spicy, Warm, and Relaxed, with some tags having a ... higher score? maybe? than others, partially due to being marked as prominent.

Most importantly to me, how do I go about making the amount of tags a user may add variable, as well as making it simple to add new tags? I'm imagining that adding a table column that will likely be empty for each tag will be space inefficient, especially if I'm looking to add a lot more or many tags. Or is that exactly what I have to do? Just have giant tables of empty columns with some that are checked?
>>
File: many-to-many.png (113 KB, 1766x783)
113 KB
113 KB PNG
This is a classic problem in database schema.
https://en.wikipedia.org/wiki/Many-to-many_%28data_model%29
The simple solution is to make a mapping table. reviewID and tagID are foreign keys, and together they create a composite key (optional).

Extrapolating beyond my high school understanding but you can then presumably make a json cache like that stores each restaurant with a (tag, prominence) list.
Maybe you could make a View using a list column type?
>>
>>1543089
Oh and note the fifth tag being added. (It's highlighted green.)



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.