daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Apr 17th, 2014 42 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SET NAMES utf8;
  2. SET foreign_key_checks = 0;
  3. SET time_zone = '+02:00';
  4. SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
  5.  
  6. CREATE TABLE `question` (
  7.   `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  8.   `name` VARCHAR(255) COLLATE utf8_czech_ci NOT NULL,
  9.   PRIMARY KEY (`id`)
  10. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
  11.  
  12. INSERT INTO `question` (`id`, `name`) VALUES
  13. (1,     'First question'),
  14. (2,     'Second question'),
  15. (3,     'Third question');
  16.  
  17. CREATE TABLE `vote` (
  18.   `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  19.   `question_id` INT(10) UNSIGNED NOT NULL,
  20.   `value` tinyint(4) NOT NULL,
  21.   PRIMARY KEY (`id`),
  22.   KEY `question_id` (`question_id`),
  23.   CONSTRAINT `vote_ibfk_2` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
  24. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
  25.  
  26. INSERT INTO `vote` (`id`, `question_id`, `value`) VALUES
  27. (1,     1,      1),
  28. (2,     1,      1),
  29. (3,     1,      -1),
  30. (4,     2,      -1),
  31. (5,     2,      -1);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top