I wonder,
at many websites there is the option to like/dislike a post.
even here of course, at stackoverflow.
so, technically it's a big likes table?
user_id post_id
user_id - who voted
post_id - which post is it
is that all about?
a big likes table?
isn't there something more efficient/sophisticated?
Within a database, related data are grouped into tables, each of which consists of rows (also called tuples) and columns, like a spreadsheet. To convert your lists of data into tables, start by creating a table for each type of entity, such as products, sales, customers, and orders.
The Table Designer is a visual tool where you design and visualizes database tables. Use the SQL Server Management Studio (SSMS) Table Designer to create, edit, or delete tables, columns, keys, indexes, relationships, and constraints.
At it's most basic level, yes, that's all it is.
But then it starts to expand, trying to answer questions like:
Then you start to want to answer more in depth questions about friends and the community.
I think I can understand your concern. Having to issue a COUNT() everytime the page needs to be presented.
You certainly have to have this basic table, which will be the basis for a COUNT(), but you don't really need to COUNT() it for every access.
Create a totalling table and update it either when the page receives a like or dislike, using a trigger, or call a stored procedure to update it from time to time.
I would say each method is more indicated for different site personalities, ie, more readings or more writings, but you already know that when it comes to likes or dislikes nothing is previsible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With