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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:10:02+00:00 2026-05-28T11:10:02+00:00

I am creating following three tables in mysql POSTMASTER ADVERTISEMENT CANDIDATEMAIN Here are the

  • 0

I am creating following three tables in mysql

  1. POSTMASTER
  2. ADVERTISEMENT
  3. CANDIDATEMAIN

Here are the create statements

POSTMASTER

CREATE TABLE `postmaster` (
  `POSTCODE` int(2) NOT NULL DEFAULT '0',
  `POSTNAME` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`POSTCODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

ADVERTISEMENT

CREATE TABLE `advertisment` (
  `ADVTNO` varchar(35) NOT NULL,
  `ADVTDATE` date NOT NULL,
  `POSTCODE` int(2) NOT NULL,
  `ADVTOPENDATE` date NOT NULL COMMENT 'ADVERTISEMENT OPENING DATE',
  `ADVTCLOSEDATE` date NOT NULL COMMENT 'ADVERTISEMENT CLOSING DATE',
  `EDITCLOSEDATE` date NOT NULL COMMENT 'CLOSING DATE FOR EDITING APPLICATION',
  `LASTREPRINTDATE` date NOT NULL COMMENT 'LAST DATE FOR REPRINTING APPLICATION',
  `FEESCST` int(4) NOT NULL COMMENT 'FEE FOR SC/ST CATEGORY',
  `FEESTAFF` int(4) DEFAULT NULL COMMENT 'FEE FOR STAFF ',
  `FEEOBC` int(4) DEFAULT NULL COMMENT 'FEE FOR OBC CATEGORY',
  `ADVOCATEEXPERIENCE` int(2) DEFAULT NULL,
  PRIMARY KEY (`ADVTNO`,`ADVTDATE`,`POSTCODE`),
  KEY `fk_post` (`POSTCODE`),
  CONSTRAINT `fk_post` FOREIGN KEY (`POSTCODE`) REFERENCES `postmaster` (`POSTCODE`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

Everything till here is fine but when I go for creation of the CANDIDATEMAIN table I get error

Here is the create statement of CANDIDATEMAIN

CREATE TABLE `candidatemain` (

  `ADVTNO` varchar(35) NOT NULL DEFAULT '',
  `ADVTDATE` date NOT NULL DEFAULT '0000-00-00',
  `POSTCODE` int(2) NOT NULL DEFAULT '0',
  `REGISTRATIONNO` int(6) NOT NULL DEFAULT '0',
  `SALUTATION` varchar(10) NOT NULL,
  `FULLNAME` varchar(90) NOT NULL,
  `SURNAME` varchar(30) DEFAULT NULL,
  `NAME` varchar(30) NOT NULL,
  `LASTNAME` varchar(30) DEFAULT NULL,
  `LASTUPDATEDIP` varchar(20) NOT NULL DEFAULT '',
  `LASTUPDATEDDATE` date DEFAULT NULL,
  `ENTRYDATE` date NOT NULL,
  PRIMARY KEY (`ADVTNO`,`ADVTDATE`,`POSTCODE`,`REGISTRATIONNO`),
  KEY `FK_ADVT` (`ADVTNO`, `ADVTDATE`,`POSTCODE`) ,
  CONSTRAINT `FK_ADVT` FOREIGN KEY (`ADVTNO`, `ADVTDATE`,`POSTCODE`) REFERENCES `advertisment` (`ADVTNO`, `ADVTDATE`,`POSTCODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

The Error I get is :

Error Code: 1005. Can't create table 'dbName.candidatemain' (errno: 150)

What could be the reason for this error?

MYSql Verion: mysql Ver 14.14 Distrib 5.1.53, for Win64

  • 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-28T11:10:03+00:00Added an answer on May 28, 2026 at 11:10 am

    Create advertisment table with default charset as utf8;

    latin1 columns are not equivalent to utf8 columns. So foreign key constraint can not form correctly. Hence the 1005 (ER_CANT_CREATE_TABLE) error.

    Here is my mysql log.

    mysql> CREATE TABLE `advertisment` (
        ->   `ADVTNO` varchar(35) NOT NULL,
        ->   `ADVTDATE` date NOT NULL,
        ->   `POSTCODE` int(2) NOT NULL,
        ->   `ADVTOPENDATE` date NOT NULL COMMENT 'ADVERTISEMENT OPENING DATE',
        ->   `ADVTCLOSEDATE` date NOT NULL COMMENT 'ADVERTISEMENT CLOSING DATE',
        ->   `EDITCLOSEDATE` date NOT NULL COMMENT 'CLOSING DATE FOR EDITING APPLICATION',
        ->   `LASTREPRINTDATE` date NOT NULL COMMENT 'LAST DATE FOR REPRINTING APPLICATION',
        ->   `FEESCST` int(4) NOT NULL COMMENT 'FEE FOR SC/ST CATEGORY',
        ->   `FEESTAFF` int(4) DEFAULT NULL COMMENT 'FEE FOR STAFF ',
        ->   `FEEOBC` int(4) DEFAULT NULL COMMENT 'FEE FOR OBC CATEGORY',
        ->   `ADVOCATEEXPERIENCE` int(2) DEFAULT NULL,
        ->   PRIMARY KEY (`ADVTNO`,`ADVTDATE`,`POSTCODE`),
        ->   KEY `fk_post` (`POSTCODE`),
        ->   CONSTRAINT `fk_post` FOREIGN KEY (`POSTCODE`) REFERENCES `postmaster` (`POSTCODE`)
        -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- <== This little change make it work.
    Query OK, 0 rows affected (0.06 sec)
    
    mysql> CREATE TABLE `candidatemain` (
        ->
        ->   `ADVTNO` varchar(35) NOT NULL DEFAULT '',
        ->   `ADVTDATE` date NOT NULL DEFAULT '0000-00-00',
        ->   `POSTCODE` int(2) NOT NULL DEFAULT '0',
        ->   `REGISTRATIONNO` int(6) NOT NULL DEFAULT '0',
        ->   `SALUTATION` varchar(10) NOT NULL,
        ->   `FULLNAME` varchar(90) NOT NULL,
        ->   `SURNAME` varchar(30) DEFAULT NULL,
        ->   `NAME` varchar(30) NOT NULL,
        ->   `LASTNAME` varchar(30) DEFAULT NULL,
        ->   `LASTUPDATEDIP` varchar(20) NOT NULL DEFAULT '',
        ->   `LASTUPDATEDDATE` date DEFAULT NULL,
        ->   `ENTRYDATE` date NOT NULL,
        ->   PRIMARY KEY (`ADVTNO`,`ADVTDATE`,`POSTCODE`,`REGISTRATIONNO`),
        ->   KEY `FK_ADVT` (`ADVTNO`, `ADVTDATE`,`POSTCODE`) ,
        ->   CONSTRAINT `FK_ADVT` FOREIGN KEY (`ADVTNO`, `ADVTDATE`,`POSTCODE`) REFERENCES `advertisment ` (`ADVTNO`, `ADVTDATE`,`POSTCODE`)
        -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    Query OK, 0 rows affected (0.12 sec)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider following tables in MySQL database: entries: creator_id INT entry TEXT is_expired BOOL other:
I am creating a database model with Workbench and create the following table: CREATE
I've thought of creating a MySQL table with the following structure: id | date
I have three entities: Country, State and City with the following relationships: When creating
I'm creating the following div using javascript, task_id is an int and person_name is
In PHP, I create and execute SQL queries like the following. INSERT INTO Table
I am creating 3 tables in MySQL (Users, linkPosts, replyPosts) The first two tables
I have a problem creating a database schema for the following scenario: (I’m not
Let's say I have the following table with three columns: id | start_block |
We will be creating a MySQL database to reflect the following PHP classes: Content

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.