A simple system for creating multiple-choice questions for an audience to answer on their phones. Responses are tallied and displayed in real-time. https://openquestion.netsyms.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

database.sql 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. -- MySQL Script generated by MySQL Workbench
  2. -- Mon 05 Feb 2018 02:44:01 PM MST
  3. -- Model: New Model Version: 1.0
  4. -- MySQL Workbench Forward Engineering
  5. SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
  6. SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
  7. SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
  8. -- -----------------------------------------------------
  9. -- Schema openquestion
  10. -- -----------------------------------------------------
  11. -- -----------------------------------------------------
  12. -- Schema openquestion
  13. -- -----------------------------------------------------
  14. CREATE SCHEMA IF NOT EXISTS `openquestion` DEFAULT CHARACTER SET utf8 ;
  15. USE `openquestion` ;
  16. -- -----------------------------------------------------
  17. -- Table `openquestion`.`questions`
  18. -- -----------------------------------------------------
  19. CREATE TABLE IF NOT EXISTS `openquestion`.`questions` (
  20. `qid` INT NOT NULL AUTO_INCREMENT,
  21. `qtext` TEXT NOT NULL,
  22. `qcode` VARCHAR(20) NOT NULL,
  23. PRIMARY KEY (`qid`),
  24. UNIQUE INDEX `qid_UNIQUE` (`qid` ASC))
  25. ENGINE = InnoDB;
  26. -- -----------------------------------------------------
  27. -- Table `openquestion`.`answers`
  28. -- -----------------------------------------------------
  29. CREATE TABLE IF NOT EXISTS `openquestion`.`answers` (
  30. `aid` INT NOT NULL AUTO_INCREMENT,
  31. `atext` TEXT NOT NULL,
  32. `qid` INT NOT NULL,
  33. PRIMARY KEY (`aid`, `qid`),
  34. UNIQUE INDEX `aid_UNIQUE` (`aid` ASC),
  35. INDEX `fk_answers_questions_idx` (`qid` ASC),
  36. CONSTRAINT `fk_answers_questions`
  37. FOREIGN KEY (`qid`)
  38. REFERENCES `openquestion`.`questions` (`qid`)
  39. ON DELETE NO ACTION
  40. ON UPDATE NO ACTION)
  41. ENGINE = InnoDB;
  42. -- -----------------------------------------------------
  43. -- Table `openquestion`.`responses`
  44. -- -----------------------------------------------------
  45. CREATE TABLE IF NOT EXISTS `openquestion`.`responses` (
  46. `rid` INT NOT NULL AUTO_INCREMENT,
  47. `aid` INT NOT NULL,
  48. `qid` INT NOT NULL,
  49. `timestamp` DATETIME NOT NULL,
  50. PRIMARY KEY (`rid`, `aid`, `qid`),
  51. UNIQUE INDEX `rid_UNIQUE` (`rid` ASC),
  52. INDEX `fk_responses_answers1_idx` (`aid` ASC, `qid` ASC),
  53. CONSTRAINT `fk_responses_answers1`
  54. FOREIGN KEY (`aid` , `qid`)
  55. REFERENCES `openquestion`.`answers` (`aid` , `qid`)
  56. ON DELETE NO ACTION
  57. ON UPDATE NO ACTION)
  58. ENGINE = InnoDB;
  59. SET SQL_MODE=@OLD_SQL_MODE;
  60. SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
  61. SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;