Guest User

Untitled

a guest
Apr 25th, 2018
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. -- Write a script that takes the following mysql data,
  2. -- and imports it into a normalized, indexed postgres database.
  3.  
  4.  
  5. CREATE TABLE `polls` (
  6. `user_name` text NOT NULL,
  7. `poll_question` text NOT NULL,
  8. `poll_option_1` text NOT NULL,
  9. `poll_option_2` text NOT NULL,
  10. `poll_option_3` text NOT NULL,
  11. `poll_option_1_votes` int(11) NOT NULL,
  12. `poll_option_2_votes` int(11) NOT NULL,
  13. `poll_option_3_votes` int(11) NOT NULL
  14. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  15.  
  16. INSERT INTO `polls` VALUES ('bob','How should we respond?','Peacefully','Cautiously','Nuke it from orbit. It\'s the only way to be sure',6,6,66),('bob','What color was it, anyway?','Blue.','Vermilion.','A Suffusion of Yellow.',1,0,42),('jim','Does it work?','Infrequently.','Most of the time.','60% of the time, it works every time.',4,17,6);
  17.  
  18. CREATE TABLE `users` (
  19. `user_name` text NOT NULL,
  20. `user_email` text NOT NULL
  21. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  22.  
  23. INSERT INTO `users` VALUES ('bob','bob@mailinator.com'),('jim','jim@mailinator.com'),('joe','joe@mailinator.com'),('sam','sam@mailinator.com');
Add Comment
Please, Sign In to add comment