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 4050438
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:04:12+00:00 2026-05-20T14:04:12+00:00

So I have a database that has a structure something like this: [user_table] user_id,

  • 0

So I have a database that has a structure something like this:

[user_table] user_id, name, active
"john", "John S. Smith", true

[group_table] group_id, description, active
"abc", "test group", "true"
"cba", "second group", "true"
"bca", "third group", "true"

So now I would like to hide “abc” group from “john”.
I create a new table called “hide_group” with field user_id and group_id. I insert appropriate values and everything is nice. But it is not very well optimized. What if I have 20 users and hundreds of groups? That would mean hundreds of new records.
Is there a more optimized way to do this with relationships? I am using MyISAM engine, and if I recall, I can’t use foreign key with it.
I am reading mysql documentation but it is still a blur to me. Maybe someone could point me at the right direction?

edit, my table structure is something like this:

[group]
group_id, group_description 

[group_hide]
group_id, user_id, hide

I want to select all groups that are under “group” table. Except the ones that are hidden inside the group_id table. How can I do this? Right now I can make it either only select all records inside the group_hide table (which is not what I need), or just all records inside group, ignoring all that is in group_hide. I would like it not to select groups that are supposed to be hidden, but everything else should be visible.

  • 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-05-20T14:04:12+00:00Added an answer on May 20, 2026 at 2:04 pm

    If you can categorize the users and their group visibility somehow, you might consider defining certain “roles”. So the associations would be between a role (say “Admin” or “Default” or “Moderator”) and the groups, and between roles and users.

    E.g. you would create a table roles with an ID and a name, a table roles_users with 2 columns role_id and user_id and another table hidden_categories_roles with 2 columns hidden_category_id and role_id. Don’t forget to put indexes on both columns in both tables to speed up queries.

    If the users are so different that they can’t be categorized, your approach is the correct one, and you should simply define indexes on both columns of your new table to speed up queries.

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

Sidebar

Related Questions

I have a database that has four columns like this level_1, level_2, level_3, level_4
I have a database structure that has a Person table which contains fields such
I have a database with user 'dbo' that has a login name domain\xzy. How
I have a database structure that has two one-to-many relationships. I have a website,
I have a table in a MySQL Database which has this structure: CREATE TABLE
I have a database that has a vessel pressure that is trended every 30
I have a database that has lots of data and is all neat, normalized
I have an existing database that has some testing data into and I'm interested
Suppose I have a database table that has a timedate column of the last
I have to restore a database that has been inadvertently DROPped in MySQL 5.0.

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.