Jump to content
Fórum Script Brasil
  • 0

MySQL - ERRO 1050 - Can't Create Table


Lucas Conceição

Question

Bom pessoal,

tentei criar uma tabela aqui,

porém deu esse erro conforme título do tópico,

alguém saberia me explicar o porque?

Código de criação:

CREATE TABLE contaRecebe(
        id            INT             NOT NULL AUTO_INCREMENT,
                                 PRIMARY KEY (id),
        nomeA_Alu    VARCHAR(60)     NOT NULL,
                                 FOREIGN KEY (nomeA_Alu) REFERENCES Aluno(nomeA),
        esporte_Alu    VARCHAR(20)  NOT NULL,
                                 FOREIGN KEY (esporte_Alu) REFERENCES Aluno(esporte),
        nf            INT             NOT NULL,
        dtVenc        DATE         NOT NULL,
        valor        VARCHAR(8)   NOT NULL
        
        );

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

tente assim:

CREATE TABLE contaRecebe(

id INT NOT NULL AUTO_INCREMENT,

nomeA_Alu VARCHAR(60) NOT NULL,

esporte_Alu VARCHAR(20) NOT NULL,

nf INT NOT NULL,

dtVenc DATE NOT NULL,

valor VARCHAR(8) NOT NULL

PRIMARY KEY (id),

FOREIGN KEY (nomeA_Alu) REFERENCES Aluno(nomeA),

FOREIGN KEY (esporte_Alu) REFERENCES Aluno(esporte),

);

lembrando que você tem que ter essa tabela Aluno para poder funcionar as 2 chaves estrangeiras

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...