Ir para conteúdo
Fórum Script Brasil
  • 0

(Resolvido) Erro no script sql


ezio_aj

Pergunta

Galera, iniciei meus estudos em SQL e estou tentado criar as tabelas no MySql Guery Brownser ,porem ele tá apresentando erro ..

Segue o script:

CREATE TABLE CONTRATO (
dtInicio date,
nContrato integer(20) PRIMARY KEY NOT NULL,
nParcelas integer(10),
dtFinal date,
nomeCurso varchar(30),
cpf integer(20)
);

CREATE TABLE ALUNO (
cpf integer(29) PRIMARY KEY NOT NULL,
nome varchar(40)
);

CREATE TABLE CONTAaRECEBER (
valorPago real,
estatus varchar,
cpf integer(29),
nDocumento integer,
codConta integer PRIMARY KEY NOT NULL AUTO_INCREMENT,
FOREIGN KEY(cpf) REFERENCES ALUNO (cpf)
);

CREATE TABLE DOCUMENTO (
nDocumento integer(10) PRIMARY KEY NOT NULL,
tipoDocumento varchar(20),
valor real
);

ALTER TABLE CONTRATO ADD FOREIGN KEY(cpf) REFERENCES ALUNO (cpf)
ALTER TABLE CONTA A RECEBER ADD FOREIGN KEY(nDocumento) REFERENCES DOCUMENTO (nDocumento)
O erro que ele apresenta:

15 You have an error in your SQL syntax: check the manual that corresponds to your MySql server version for the right syntax to use near ' 1064
cpf integer(29),
nDocumento integer,
codConta integer PRIMARY KEY NOT NULL A' at line 3

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

Visitante
Este tópico está impedido de receber novos posts.


  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...