0
I need to make a Mysql database, Escola
, with entities aluno
, professor
and disciplina
, linked via foreign key.
I made mine script, but it’s making a mistake. Could you help me? Follow what I did:
CREATE DATABASE ESCOLA
DEFAULT CHARACTER SET uft8
DEFAULT COLLATE utf8_general_ci;
use escola;
CREATE TABLE professor(
nome varchar(50) not null ,
idade int(2) ,
salario float(4,2) ,
cod_prof int(10) not null,
primary key cod_prof
)CHARSET=utf8
CREATE TABLE aluno(
nome varchar(50) not null,
id int(10) not null AUTO_INCREMENT,
cod_aluno int(10) not null,
cod_dis int(10) not null,
PRIMARY KEY (cod_aluno)
CONSTRAINT cod_dis FOREIGN KEY (cod_dis) REFERENCES disciplina(cod_dis)
)CHARSET=utf8
CREATE TABLE disciplina(
nome varchar(50) not null,
carga_horaria char(2) ,
cod_prof int(10) not null,
cod_dis int(10) not null,
FOREIGN KEY (cod_prof) REFERENCES professor(cod_prof)
PRIMARY KEY (cod_dis)
)CHARSET=utf8
Error Code: 1064. 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 ')CHARSET=utf8' at line 7
Missed to put the error...
– Woss
I believe you do not have this = in CHARSET=utf8. But you no longer set for the whole bank?
– anonimo
I’m starting.. I saw in some videos of the internet that with these codes I can put accent in the words.
– Dhanzo
student makes reference to discipline , created after, Since this.
– Motta