Guest User

Computer game results

a guest
Jun 2nd, 2012
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. /*!40101 SET NAMES utf8 */;
  3.  
  4. /*!40101 SET SQL_MODE=''*/;
  5.  
  6. /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  7. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  8. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  9. /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  10. CREATE DATABASE /*!32312 IF NOT EXISTS*/`tester` /*!40100 DEFAULT CHARACTER SET utf8 */;
  11.  
  12. /*Table structure for table `games` */
  13.  
  14. CREATE TABLE `games` (
  15.   `game_id` int(11) NOT NULL AUTO_INCREMENT,
  16.   `game_name` varchar(50) DEFAULT NULL,
  17.   `game_duration` int(11) DEFAULT NULL,
  18.   PRIMARY KEY (`game_id`)
  19. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
  20.  
  21. /*Data for the table `games` */
  22.  
  23. insert  into `games`(`game_id`,`game_name`,`game_duration`) values (1,'Game A',300),(2,'Game B',258);
  24.  
  25. /*Table structure for table `games_teams` */
  26.  
  27. CREATE TABLE `games_teams` (
  28.   `game_team_id` int(11) NOT NULL AUTO_INCREMENT,
  29.   `game_id` int(11) DEFAULT NULL,
  30.   `team_id` int(11) DEFAULT NULL,
  31.   `team_score` int(3) DEFAULT NULL,
  32.   PRIMARY KEY (`game_team_id`),
  33.   KEY `FK_games_teams_games` (`game_id`),
  34.   KEY `FK_games_teams_teams` (`team_id`),
  35.   CONSTRAINT `FK_games_teams_teams` FOREIGN KEY (`team_id`) REFERENCES `teams` (`team_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  36.   CONSTRAINT `FK_games_teams_games` FOREIGN KEY (`game_id`) REFERENCES `games` (`game_id`) ON DELETE CASCADE ON UPDATE CASCADE
  37. ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
  38.  
  39. /*Data for the table `games_teams` */
  40.  
  41. insert  into `games_teams`(`game_team_id`,`game_id`,`team_id`,`team_score`) values (1,1,1,45),(2,1,2,55),(3,2,3,60),(4,2,4,65);
  42.  
  43. /*Table structure for table `teams` */
  44.  
  45. CREATE TABLE `teams` (
  46.   `team_id` int(11) NOT NULL AUTO_INCREMENT,
  47.   `team_name` varchar(50) DEFAULT NULL,
  48.   PRIMARY KEY (`team_id`)
  49. ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
  50.  
  51. /*Data for the table `teams` */
  52.  
  53. insert  into `teams`(`team_id`,`team_name`) values (1,'Team A'),(2,'Team B'),(3,'Team C'),(4,'Team D');
  54.  
  55. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  56. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  57. /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  58. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
RAW Paste Data