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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:53:57+00:00 2026-05-23T07:53:57+00:00

I need some help to structure some tables that will help me out having

  • 0

I need some help to structure some tables that will help me out having a good personalized way to have different access name per client with personalized allowed commands in each acess level.

So consider client A has create site Y, which he wants to create the follow access groups:

  • Admin (have all acess),
  • VIP (can access room 1),
  • Basic (can access louge),
  • Banned (cannot enter at all)

The same way client A create his personalized access I want all my other clients to be able to create their own personalized access where they can name it anything they see fit in their own language and later just put in what commands they will have access to by being on that given access level.

I have the follow tables as example (sorry that this isnt a datagram, work bench keep crashing on me when I make example and I am open to suggestion for alternatives to create datagrams as good as or better than workbench):

  • client TABLE:

    id int,
    username varchar,
    password varchar,
    status varchar
    
  • site TABLE:

    id int,
    owner_client_id,
    name varchar
    
  • access TABLE:

    id int,
    name varchar,
    commands int (bitmask?)
    
  • site_access TABLE

    id int,
    client_id,
    site_id,
    access_id
    
  • commands

    id int,
    action varchar,
    alias varchar,
    description varchar
    

On my application all the commands actions are alredy pre-defined and the user cannot change them in what they do or the default name, but they are allowed to create alias.

So let’s say I have the command kick, they could make an alias to name it “k” or “explosion” or they could name the alias anything they want.

Some of my doubts:

  1. Initially I tought of using site_access to link everything together, client that has access to site and what access it has and from their access what commands each have, is that a good way to go with it ?

  2. I have many commands that will be pulled from the database but since some have their own alias I dont thin I could use a bitmask for the acess and still being able to query the alias if not null could I so I would have to use a list of commands or are there good options ?

  3. What engine should I use, InnoDB or MyISAM in my case ?

  4. Is it ok to mix engines or not a good idea at all ?

  5. What should I change on my current table structure and could you provide any samples too (if possible) ?

UPDATE:

enter image description here

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `mydb` ;

-- -----------------------------------------------------
-- Table `mydb`.`clients`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`clients` ;

CREATE  TABLE IF NOT EXISTS `mydb`.`clients` (
  `id` INT NOT NULL,
  `username` VARCHAR(45) NOT NULL ,
  `password` VARCHAR(45) NOT NULL ,
  PRIMARY KEY (`id`) ,
  UNIQUE INDEX `username_UNIQUE` (`username` ASC) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`sites`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`sites` ;

CREATE  TABLE IF NOT EXISTS `mydb`.`sites` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(45) NOT NULL ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`groups`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`groups` ;

CREATE  TABLE IF NOT EXISTS `mydb`.`groups` (
  `id` INT NOT NULL ,
  `name` VARCHAR(45) NOT NULL ,
  `alias` VARCHAR(45) NOT NULL ,
  `commands` VARCHAR(45) NOT NULL ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`membership`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`membership` ;

CREATE  TABLE IF NOT EXISTS `mydb`.`membership` (
  `client_id` INT NOT NULL ,
  `group_id` INT NOT NULL ,
  PRIMARY KEY (`client_id`, `group_id`) ,
  INDEX `client_id` (`client_id` ASC) ,
  INDEX `group_id` (`group_id` ASC) ,
  CONSTRAINT `client_id`
    FOREIGN KEY (`client_id` )
    REFERENCES `mydb`.`clients` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `group_id`
    FOREIGN KEY (`group_id` )
    REFERENCES `mydb`.`groups` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`access`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`access` ;

CREATE  TABLE IF NOT EXISTS `mydb`.`access` (
  `site_id` INT NOT NULL ,
  `group_id` INT NOT NULL ,
  PRIMARY KEY (`site_id`, `group_id`) ,
  INDEX `site_id` (`site_id` ASC) ,
  INDEX `group_id` (`group_id` ASC) ,
  CONSTRAINT `site_id`
    FOREIGN KEY (`site_id` )
    REFERENCES `mydb`.`sites` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `group_id`
    FOREIGN KEY (`group_id` )
    REFERENCES `mydb`.`groups` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;



SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
  • 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-23T07:53:58+00:00Added an answer on May 23, 2026 at 7:53 am

    I would do it a bit differently

    • Client Table
    • Group Table
    • Membership Table (Client – Group)
    • Site Table
    • Access Table (Group Site)

    Also see pages 12-13 in this link for ideas http://support.sas.com/resources/papers/proceedings09/265-2009.pdf

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

Sidebar

Related Questions

Need some help assigning a mouseover event to display some icons that start out
I need some help from the shell-script gurus out there. I have a .txt
Need some help about with Memcache. I have created a class and want to
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
Need some help to solve this. I have a gridview and inside the gridview
Need some help from javascript gurus. I have one page where http://www.google.com/finance/converter is embedded
I have a table that I need to get some specific data from for
I need help understanding the best way to manipulate a JavaScript data structure (if
I have to write a component that re-creates SQL Server tables (structure and data)
Preamble: I'm creating some tables in SQL Server that will be accessed via Linq-to-entities

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.