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

  • Home
  • SEARCH
  • 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 7413387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:41:14+00:00 2026-05-29T06:41:14+00:00

I keep getting the following error: * #1005 – Can’t create table ‘classorganizer.turma’ (errno:

  • 0

I keep getting the following error: *#1005 – Can’t create table ‘classorganizer.turma’ (errno: 150) (Detalhes…) *

from trying to create the table Turma although I’ve double checked all the foreign keys cases in that class. Does anyone knows whats wrong?

Thank you!

CREATE TABLE Usuario(
email VARCHAR(50) NOT NULL,
nome VARCHAR(30),
senha INTEGER NOT NULL,
dataCadastro DATE NOT NULL,

CONSTRAINT pkUsu PRIMARY KEY(email),
CONSTRAINT formatoEmail CHECK(email LIKE '%@%.%')
)ENGINE=InnoDB;

CREATE TABLE Professor(
id INTEGER NOT NULL AUTO_INCREMENT,
nome VARCHAR(30) NOT NULL UNIQUE,
ranking INTEGER DEFAULT 3,
usuario VARCHAR(50) NOT NULL,

CONSTRAINT pk_prof PRIMARY KEY (id),
CONSTRAINT fk_usu FOREIGN KEY (usuario) REFERENCES Usuario(email) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT limites_rank CHECK(ranking >0 AND ranking<6)
)ENGINE=InnoDB;

CREATE TABLE Materia(
codigo VARCHAR(8) NOT NULL,
nro_turmas INTEGER DEFAULT 0,
nome VARCHAR(20) NOT NULL UNIQUE,
nro_cred_aula INTEGER DEFAULT 0,
nro_cred_trab INTEGER DEFAULT 0,
prioridade INTEGER DEFAULT 3,
usuario VARCHAR(50) NOT NULL,

CONSTRAINT pk_prof PRIMARY KEY (id),
CONSTRAINT fk_usu FOREIGN KEY (usuario) REFERENCES Usuario(email) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT limites_prio CHECK(prioridade >0 AND prioridade<6)
)ENGINE=InnoDB;

CREATE TABLE Turma(
nro INTEGER NOT NULL AUTO_INCREMENT,
prioridade INTEGER DEFAULT 3,
materia VARCHAR(8) NOT NULL,
professor INTEGER NOT NULL,
usuario VARCHAR(50) NOT NULL,

CONSTRAINT pk_turma PRIMARY KEY (nro),
CONSTRAINT fk_mat FOREIGN KEY (materia) REFERENCES Materia(codigo) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT fk_prof FOREIGN KEY (professor) REFERENCES Professor(id) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT fk_usu FOREIGN KEY (usuario) REFERENCES Usuario(email) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT limites_prio CHECK(prioridade >0 AND prioridade<6)
)ENGINE=InnoDB;
  • 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-29T06:41:14+00:00Added an answer on May 29, 2026 at 6:41 am

    There are lots of errors.

    1. CONSTRAINT pk_prof PRIMARY KEY (id). id column doesn’t exist in table Materia.
    2. Constraint names (pk_prof, fk_usu) are already used in Professor table. You have used it in both Materia and Turma table.
      Correct it by choosing unique names. Easiest way is to omit the name. MySQL handle it.
    3. codigo column of Materia is referenced in Turma table, But its not a *key.*
    4. professor column of Turma is defined to be NOT NULL. But you used ON DELETE SET NULL.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting the following error: AttributeError: Caribou instance has no attribute 'on_key_up' The
I keep getting the following error message ERROR 1064 (42000): You have an error
When I deploy my application to GoogleAppEngine I keep getting the following error Uncaught
I'm using Visual Studio 2008 Express edition, and keep getting the following error: Cascadedisplay.h(4)
I keep getting an error with the following bit of code. It is probably
With the following code, I keep getting error C2535 when I compile. It's complaining
I keep getting the following error after I put the required files in my
I'm pretty new to ruby, I keep getting the following error: in gem_original_require': ./helpers/navigation.rb:28:
I installed the playframework fbconnect module (version 0.6). I keep getting the following error.
I'm trying to bake my controllers but I keep getting the following error: It's

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.