Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8660953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:22:56+00:00 2026-06-12T16:22:56+00:00

I have a table users: user_id – name And those users can create an

  • 0

I have a table users:

user_id - name

And those users can create an article and then share it with other members, table articles:

article_id - user_id - article_name

The question is the best way to share it… I’m thinking another table article_shares:

share_id - article_id - user_id

This would simply list all users with access to that aerticle and the creator would have access to be able to add or delete from that table for the article they created

So, when the article creator (user_id 123) looks at his articles he can see a list of all other users he has shared each article with

select as.user_id, a.article_name from article_shares as
join users u on u.user_id = as.user_id
join articles a on a.article_id = as.article_id where u.user_id = '123'

and a user (user_id 456) can see a list of articles they have been shared

select a.article_name from articles a
join article_shares as on as.article_id = a.article_id
where as.user_id = '456'

Does this seem logical? Am I on the right track?

Thanks for any help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:22:57+00:00Added an answer on June 12, 2026 at 4:22 pm

    You’ve got it right. If you’re curious, you’ve made a junction table to create your many-to-many relationship between users and articles, and this is fairly standard.

    You’ll often see these types of tables named like ArticlesToUsers or something similar, and that will sometimes be the first way to tip you off that you’re looking at a junction table. Of course, naming schemes are pretty subjective, so don’t feel the need to change the name. article_shares seems like a good description to me.

    As @MaxVT has demonstrated, you’ll find that many developers won’t put a surrogate key on a junction table like this, and would rather just use both columns as the primary key (article_id, user_id). The choice is obviously yours and may have more to do with staying consistent with the rest of the database tables, though you’ll certainly see all permutations in the wild. In the event that you do keep your surrogate key, I’d recommend a unique constraint of article_id, user_id anyway to eliminate duplicates (why would an article need to be shared to a user twice?).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an InnoDB table containing users, like this: +--------------+-----------------------+ | user_id | name
Say I have a table like this: create table users ( user_id int not
I have a table like: Users (user_id, name, age, country_id) Now I want a
I have 4 tables. Table A that has users - ( user_id, username, and
I have 3 tables users(id,name),groups(id,name) and users_groups(user_id,group_id). users and groups have many to many
I have a table: **user** id, name, points Can you suggest me how to
I have two tables user table user_id | name | 1 | peter |
I have 3 tables: users (id, name) currency (id, name) accounts (id, user_id, currency_id,
I have one MySQL table, users , with the following columns: user_id (PK) email
For example, I have a table of bank users (user id, user name), and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.