Skip to content

Instantly share code, notes, and snippets.

@felipevr
Last active September 18, 2017 02:36
Show Gist options
  • Save felipevr/04b960caf26df64c4d97d129e6f20b97 to your computer and use it in GitHub Desktop.
Save felipevr/04b960caf26df64c4d97d129e6f20b97 to your computer and use it in GitHub Desktop.
Sample Database Schema
CREATE DATABASE IF NOT EXISTS `grade_disciplinar` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `grade_disciplinar`;
CREATE TABLE cursos (
id INT AUTO_INCREMENT PRIMARY KEY,
nome VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
created DATETIME NOT NULL ,
updated DATETIME NOT NULL
);
CREATE TABLE disciplinas (
id INT AUTO_INCREMENT PRIMARY KEY,
curso_id INT NOT NULL,
nome VARCHAR(50) NOT NULL ,
carga_horaria INT(3) NOT NULL ,
created DATETIME NOT NULL ,
modified DATETIME NOT NULL,
FOREIGN KEY user_key (curso_id) REFERENCES cursos(id)
);
INSERT INTO cursos VALUES(1, 'computação', 'teste@curso.com', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO cursos VALUES(2, 'matematica', 'mat@ufms.br', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO cursos VALUES(3, 'engenharia', 'eng@ufms.br', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment