
CREATE DATABASE 'lokaal222';


SET FOREIGN_KEY_CHECKS=0;

DROP TABLE IF EXISTS `cursist`;
CREATE TABLE `cursist` (
  `cursistnr` decimal(10,0) NOT NULL,
  `cursistvoornaam` varchar(255) default NULL,
  `cursistachternaam` varchar(255) default NULL,
  `klasnr` decimal(10,0) default NULL,
  `cursistww` varchar(255) default NULL,
  `cursistwwreset` binary(1) default NULL,
  PRIMARY KEY  (`cursistnr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


DROP TABLE IF EXISTS `docent`;
CREATE TABLE `docent` (
  `docentnr` decimal(10,0) NOT NULL,
  `docentvoornaam` varchar(255) default NULL,
  `docentachternaam` varchar(255) default NULL,
  `docentww` varchar(255) default NULL,
  `docentwwreset` binary(1) default NULL,
  PRIMARY KEY  (`docentnr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


DROP TABLE IF EXISTS `faq`;
CREATE TABLE `faq` (
  `faqnr` decimal(10,0) NOT NULL,
  `faqonderwerp` varchar(255) default NULL,
  `faqomschrijving` varchar(255) default NULL,
  PRIMARY KEY  (`faqnr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


DROP TABLE IF EXISTS `kalender`;
CREATE TABLE `kalender` (
  `datum` date NOT NULL default '0000-00-00',
  `dagdeel` varchar(255) NOT NULL default '',
  `werkpleknr` decimal(10,0) NOT NULL default '0',
  `registratienr` decimal(10,0) default NULL,
  `cursistnr` decimal(10,0) default NULL,
  PRIMARY KEY  (`datum`,`dagdeel`,`werkpleknr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


DROP TABLE IF EXISTS `klas`;
CREATE TABLE `klas` (
  `klasnr` decimal(10,0) NOT NULL,
  `klasnaam` varchar(255) default NULL,
  PRIMARY KEY  (`klasnr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `materialen`;
CREATE TABLE `materialen` (
  `materiaalnr` decimal(10,0) NOT NULL default '0',
  `materiaalnaam` varchar(255) default NULL,
  `materiaalomschrijving` varchar(255) default NULL,
  PRIMARY KEY  (`materiaalnr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


DROP TABLE IF EXISTS `opdracht`;
CREATE TABLE `opdracht` (
  `opdrachtnr` decimal(10,0) NOT NULL,
  `opdrachtnaam` varchar(255) default NULL,
  `opdrachtomschrijving` varchar(255) default NULL,
  PRIMARY KEY  (`opdrachtnr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


DROP TABLE IF EXISTS `regels`;
CREATE TABLE `regels` (
  `regelnr` decimal(10,0) NOT NULL,
  `regelonderwerp` varchar(255) default NULL,
  `regelomschrijving` varchar(255) default NULL,
  PRIMARY KEY  (`regelnr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


DROP TABLE IF EXISTS `registratie`;
CREATE TABLE `registratie` (
  `registratienr` decimal(10,0) NOT NULL default '0',
  `cursistnr` decimal(10,0) default NULL,
  `begindatum` date default NULL,
  `einddatum` date default NULL,
  `begindagdeel` varchar(255) default NULL,
  `einddagdeel` varchar(255) default NULL,
  `opdrachtnr` decimal(10,0) default NULL,
  PRIMARY KEY  (`registratienr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- ----------------------------
-- Table structure for registratiemedecursist
-- ----------------------------
DROP TABLE IF EXISTS `registratiemedecursist`;
CREATE TABLE `registratiemedecursist` (
  `registratienr` decimal(10,0) NOT NULL default '0',
  `medecursistnr` decimal(10,0) NOT NULL default '0',
  PRIMARY KEY  (`registratienr`,`medecursistnr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


DROP TABLE IF EXISTS `registratiewerkplek`;
CREATE TABLE `registratiewerkplek` (
  `Registratienr` decimal(10,0) NOT NULL default '0',
  `werkpleknr` decimal(10,0) NOT NULL default '0',
  PRIMARY KEY  (`Registratienr`,`werkpleknr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


DROP TABLE IF EXISTS `vakantie`;
CREATE TABLE `vakantie` (
  `vakantienr` decimal(10,0) NOT NULL default '0',
  `begindatum` date default NULL,
  `einddatum` date default NULL,
  `omschrijving` varchar(255) default NULL,
  PRIMARY KEY  (`vakantienr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


DROP TABLE IF EXISTS `werkplekken`;
CREATE TABLE `werkplekken` (
  `werkpleknr` decimal(10,0) NOT NULL default '0',
  `materiaalnr` decimal(10,0) NOT NULL default '0',
  PRIMARY KEY  (`werkpleknr`,`materiaalnr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


INSERT INTO `cursist` VALUES ('30018', 'Rick', 'de Weger', '1', 'rick', '0');
