how can i structure posts, shared posts and pages table in mysql database?

45
February 12, 2019, at 10:40 AM

I am working on a social networking site and i need to structure my POSTS table, SHARED_POSTS table and PAGES table and i don't know the best way to go about this. i have my USERS table and each post being made by a user is stored in the POSTS table with the current user's id. I also want at the end of everything i should be able to join all the four tables and list all the posts made by my site users and shared posts and pages posts(i.e the pages that the current user liked) according to DATE in descending order just like facebook. Any help will be appreciated...

POSTS table

post_id, userId, post_content, post_status, post_photo, photo_descript, department, post_date

SHARED_POSTS table

ShareId, SharedUserId, SharedPostId, OwnerPostId, SharedPostContent, SharedPostDescript, SharedPostStatus, SharedPostDate

PAGES_POST table

p_id, pageId, page_content, page_status, post_photo, photo_descript, post_date

$sql="SELECT * FROM POSTS,USERS,SHARED_POSTS, PAGES_POST WHERE user_id=userId ORDER BY post_date DESC ";

I want to have something about the query above

i want at the end of the day, i should be able to display the current user's posts, pages liked posts and posts shared

READ ALSO
Mysql order on calculation with variable from outside tables

Mysql order on calculation with variable from outside tables

Can I do a calculation like this in MySQL:

34
What type of join to use here?

What type of join to use here?

I have two tables: StorageTransactions and FutureStockUsageMaterials

53
How to check if directory is correct for uploading files in php?

How to check if directory is correct for uploading files in php?

I am making an application form for users to apply for jobs and upload their CVsThe php code I made sends the file name to the DB so it is working correctly I guess

44
Creating a Pivot (crosstab) query for a golf league [on hold]

Creating a Pivot (crosstab) query for a golf league [on hold]

I’m trying to create a pivot query (Cross Tab)for a golf league with about 20 playersIn my database I place the playerID, Name, Date, Round#(1,2,3, etc) and score

37