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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:14:35+00:00 2026-06-07T09:14:35+00:00

CREATE TABLE emp_u ( id INT NOT NULL AUTO_INCREMENT, emailAddress VARCHAR(100) NOT NULL, username

  • 0
CREATE TABLE emp_u (
        id      INT NOT NULL AUTO_INCREMENT,
        emailAddress    VARCHAR(100) NOT NULL,
        username        VARCHAR(30) NOT NULL,
        passwd          VARCHAR(40) NOT NULL,
        title           CHAR(4) NOT NULL,
        firstName       VARCHAR(50) NOT NULL,
        surname         VARCHAR(50) NOT NULL,
        PRIMARY KEY (id),
        UNIQUE KEY(emailAddress),
        UNIQUE KEY(username),
        KEY idx_fullname (firstName, surname)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE emp_u_p (
    employer_id_fk  INT NOT NULL DEFAULT 0,
    s_mgt           TINYINT(1) NOT NULL DEFAULT 0,
    add_j_mgt       TINYINT(1) NOT NULL DEFAULT 0,
    edit_j_mgt      TINYINT(1) NOT NULL DEFAULT 0,
    del_j_mgt       TINYINT(1) NOT NULL DEFAULT 0,
    j_mgt           TINYINT(1) NOT NULL default 0,
    cp_mgt  TINYINT(1) NOT NULL default 0,
    ph_mgt      TINYINT(1) NOT NULL default 0,
    cb_mgt      TINYINT(1) NOT NULL default 0,
    search_mgt      TINYINT(1) NOT NULL default 0,
    PRIMARY KEY (employer_id_fk)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

I have these two tables in my database. Will be better to combine these two tables together or leave then as it is.

I’m new to database and just write some tables for my mysql.

  • 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-07T09:14:36+00:00Added an answer on June 7, 2026 at 9:14 am

    If we are advising toward normalization (always!), then I suggest you leave them as two tables, but change the nature of the permissions table to be a one-to-many instead of 1-1 like it appears to be now.

    There should be one row for each employee in the employee table, and then one row per permission in the permissions table.

    CREATE TABLE emp_u_p (
     emp_u_id INT NOT NULL DEFAULT 0,
     permission_name varchar
    );
    

    This is highly advantageous when you need to add permission types to your system; you will not need to refactor your schema. If you want to really go all the way, make a third table called “permissions”, and then have a many-to-many, where your employee_permissions table is just two foreign keys: one for employee_id and one for permission_id

    To select employees with a given permission:

    SELECT emp_u.* 
    FROM emp_u JOIN emp_u_p 
      ON emp_u.id = emp_u_p.emp_u_id 
      AND permission_name = "add_j_mgt";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

CREATE TABLE `tbl_atn` ( `atn_id` int(15) NOT NULL AUTO_INCREMENT, `eng_id` int(15) DEFAULT NULL, `visit`
create table snippet( id int not null auto_increment, primary key(id), idlanguage int not null,
Create Table: CREATE TABLE `category` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255)
CREATE TABLE Posts { id INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(200), url VARCHAR(200) }
my table structure is CREATE TABLE [dbo].[Emp]( [ID] [int] NOT NULL, [EmpName] [varchar](50) NOT
Table definition: CREATE TABLE IF NOT EXISTS `submenu_cat` ( `id` int(11) NOT NULL AUTO_INCREMENT,
create table employee (emp_id smallint unsigned not null auto_increment, fname varchar(20) not null, lname
Create Table employees ( emp_id char(5) not null, hourly_pay integer not null, emp_name varchar(30)
I have a query like CREATE TABLE EMPLOYEE_TBL (EMP_ID CHAR(9) NOT NULL, EMP_NAME VARCHAR(40)
create table ImagenesUsuario { idImagen int primary key not null IDENTITY } This doesn't

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.