Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.45 KB | None | 0 0
  1. -- MySQL Workbench Forward Engineering
  2.  
  3. SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
  4. SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
  5. SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
  6.  
  7. -- -----------------------------------------------------
  8. -- Schema mydb
  9. -- -----------------------------------------------------
  10. -- -----------------------------------------------------
  11. -- Schema practicum_week_1
  12. -- -----------------------------------------------------
  13.  
  14. -- -----------------------------------------------------
  15. -- Schema practicum_week_1
  16. -- -----------------------------------------------------
  17. CREATE SCHEMA IF NOT EXISTS `practicum_week_1` DEFAULT CHARACTER SET utf8 ;
  18. USE `practicum_week_1` ;
  19.  
  20. -- -----------------------------------------------------
  21. -- Table `practicum_week_1`.`gebouw`
  22. -- -----------------------------------------------------
  23. CREATE TABLE IF NOT EXISTS `practicum_week_1`.`gebouw` (
  24. `gebouwcode` VARCHAR(25) NOT NULL,
  25. `locatie` VARCHAR(45) NULL DEFAULT NULL,
  26. PRIMARY KEY (`gebouwcode`),
  27. UNIQUE INDEX `gebouwcode_UNIQUE` (`gebouwcode` ASC) VISIBLE)
  28. ENGINE = InnoDB
  29. DEFAULT CHARACTER SET = utf8;
  30.  
  31.  
  32. -- -----------------------------------------------------
  33. -- Table `practicum_week_1`.`afdeling`
  34. -- -----------------------------------------------------
  35. CREATE TABLE IF NOT EXISTS `practicum_week_1`.`afdeling` (
  36. `afdelingcode` VARCHAR(25) NOT NULL,
  37. `naam` VARCHAR(45) NULL DEFAULT NULL,
  38. `gebouwcode` VARCHAR(45) NULL DEFAULT NULL,
  39. PRIMARY KEY (`afdelingcode`),
  40. UNIQUE INDEX `afdelingcode_UNIQUE` (`afdelingcode` ASC) VISIBLE,
  41. INDEX `gebouwcode_idx` (`gebouwcode` ASC) VISIBLE,
  42. CONSTRAINT `gebouwcode`
  43. FOREIGN KEY (`gebouwcode`)
  44. REFERENCES `practicum_week_1`.`gebouw` (`gebouwcode`))
  45. ENGINE = InnoDB
  46. DEFAULT CHARACTER SET = utf8;
  47.  
  48.  
  49. -- -----------------------------------------------------
  50. -- Table `practicum_week_1`.`chef`
  51. -- -----------------------------------------------------
  52. CREATE TABLE IF NOT EXISTS `practicum_week_1`.`chef` (
  53. `chef_id` INT(11) NOT NULL AUTO_INCREMENT,
  54. `vanaf` DATE NULL DEFAULT NULL,
  55. `tot` DATE NULL DEFAULT NULL,
  56. `naam` VARCHAR(45) NULL DEFAULT NULL,
  57. PRIMARY KEY (`chef_id`),
  58. UNIQUE INDEX `naam_UNIQUE` (`chef_id` ASC) VISIBLE)
  59. ENGINE = InnoDB
  60. AUTO_INCREMENT = 10
  61. DEFAULT CHARACTER SET = utf8;
  62.  
  63.  
  64. -- -----------------------------------------------------
  65. -- Table `practicum_week_1`.`werknemers`
  66. -- -----------------------------------------------------
  67. CREATE TABLE IF NOT EXISTS `practicum_week_1`.`werknemers` (
  68. `personeelsnr` INT(11) NOT NULL,
  69. `naam` VARCHAR(45) NULL DEFAULT NULL,
  70. `afdelingcode` VARCHAR(25) NULL DEFAULT NULL,
  71. `chef_id` INT(11) NULL DEFAULT NULL,
  72. PRIMARY KEY (`personeelsnr`),
  73. UNIQUE INDEX `personeelsnr_UNIQUE` (`personeelsnr` ASC) VISIBLE,
  74. INDEX `afdelingcode_idx` (`afdelingcode` ASC) VISIBLE,
  75. INDEX `id_idx` (`naam` ASC) VISIBLE,
  76. INDEX `chef_id_idx` (`chef_id` ASC) VISIBLE,
  77. CONSTRAINT `afdelingcode`
  78. FOREIGN KEY (`afdelingcode`)
  79. REFERENCES `practicum_week_1`.`afdeling` (`afdelingcode`),
  80. CONSTRAINT `chef_id`
  81. FOREIGN KEY (`chef_id`)
  82. REFERENCES `practicum_week_1`.`chef` (`chef_id`))
  83. ENGINE = InnoDB
  84. DEFAULT CHARACTER SET = utf8;
  85.  
  86.  
  87. SET SQL_MODE=@OLD_SQL_MODE;
  88. SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
  89. SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement