'Is it possible to create a game library database column?
The idea is to create a route which allows the logged in user to add something to their library, and also delete it if they would like to. It is essentially a game library, storing the users games. I was wondering if it's possible to create a database column as a list which you can just add the names of the games to the list, or if it requires a different solution? I guess this would work the same way as a favorites list for each user if my explanation was confusing.
Solution 1:[1]
The best solution for your case is to create a sql table Named as Library
with UserName and Games as columns.
To get list of all games of a perticular user you can use:
Select Games from Library where UserName={}
In order to delete a game of a perticular user you can use:
Delete from Library where UserName={} and Games={}
Or you want to use a no sql database then you can store all the games of a user
against his name like:
{ U_name: ["game1","game2", ....], U_name2: ....}
I prefer the first method for this case.
Here sql would solve this problem, better than nosql, since there would be lot of read and write operations.
Hope this helps.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kalyan Reddy |
