diff options
author | Marvin Borner | 2020-10-01 15:26:39 +0200 |
---|---|---|
committer | Marvin Borner | 2020-10-01 15:26:39 +0200 |
commit | 0db5748eefe59b068406e399d62ee938877e9bbd (patch) | |
tree | 20ad1bf78860b815c3e87aaf4209faa76ed9f734 | |
parent | 4466c1f5460bb0b805c7bd5b61ba46123385bc9f (diff) |
Insert
-rw-r--r-- | tables.sql | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -15,19 +15,19 @@ DROP TABLE IF EXISTS class; CREATE TABLE IF NOT EXISTS types( id INTEGER PRIMARY KEY AUTO_INCREMENT, - name VARCHAR(255) NOT NULL + name VARCHAR(255) NOT NULL UNIQUE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS class( id INTEGER PRIMARY KEY AUTO_INCREMENT, - name VARCHAR(255) NOT NULL + name VARCHAR(255) NOT NULL UNIQUE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS users( id INTEGER PRIMARY KEY AUTO_INCREMENT, username VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, - middlename VARCHAR(255) NOT NULL, + middlename VARCHAR(255) DEFAULT NULL, surname VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, class_id INTEGER NOT NULL, @@ -37,3 +37,11 @@ CREATE TABLE IF NOT EXISTS users( CONSTRAINT `fk_class_user` FOREIGN KEY (class_id) REFERENCES class (id), CONSTRAINT `fk_type_user` FOREIGN KEY (type_id) REFERENCES types (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO types VALUES (1, "teacher"), (2, "pupil"); +INSERT INTO class VALUES + (1, "TGM13.1"), + (2, "TGM13.2"), + (3, "TGTM13.1"), + (4, "TGI13.1"), + (5, "TGI13.2"); |