Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 28, 2020 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/c70988c6a958718766adfc7264ff8f58 to your computer and use it in GitHub Desktop.
Save parzibyte/c70988c6a958718766adfc7264ff8f58 to your computer and use it in GitHub Desktop.
CREATE TABLE estudiantes(
id bigint unsigned not null primary key auto_increment,
nombre varchar(255) not null,
grupo varchar(255) not null
);
CREATE TABLE materias(
id bigint unsigned not null primary key auto_increment,
nombre varchar(255) not null
);
CREATE TABLE notas_estudiantes_materias(
id bigint unsigned not null primary key auto_increment,
id_estudiante bigint unsigned not null,
id_materia bigint unsigned not null,
puntaje decimal(9,2) not null,
foreign key (id_estudiante) references estudiantes(id) on delete cascade on update cascade,
foreign key (id_materia) references materias(id) on delete cascade on update cascade
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment