Skip to content

Instantly share code, notes, and snippets.

@ogabrielguerra
Created September 25, 2020 01:10
Show Gist options
  • Save ogabrielguerra/2a6a695c60b51758126219739f3e1a32 to your computer and use it in GitHub Desktop.
Save ogabrielguerra/2a6a695c60b51758126219739f3e1a32 to your computer and use it in GitHub Desktop.
SQL Script - Courses Manager Structure
-- CREATE STRUCTURE
DROP TABLE IF EXISTS `course`;
CREATE TABLE `course` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `course_application`;
CREATE TABLE `course_application` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_user` int(11) NOT NULL,
`id_course` int(11) NOT NULL,
`application_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_course` (`id_course`,`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`email` varchar(100) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment