Subversion-Projekte lars-tiefland.em_wm

Revision

Revision 3 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

-- phpMyAdmin SQL Dump
-- version 2.8.0.4
-- http://www.phpmyadmin.net
-- 
-- Host: localhost
-- Erstellungszeit: 12. Juni 2006 um 22:22
-- Server Version: 5.0.22
-- PHP-Version: 5.1.4-pl1-gentoo

SET FOREIGN_KEY_CHECKS=0;

SET AUTOCOMMIT=0;
START TRANSACTION;

-- 
-- Datenbank: `wm2006`
-- 

-- --------------------------------------------------------

-- 
-- Tabellenstruktur für Tabelle `games`
-- 

DROP TABLE IF EXISTS `games`;
CREATE TABLE IF NOT EXISTS `games` (
  `g_id` int(10) unsigned NOT NULL auto_increment,
  `g_name` varchar(255) default NULL,
  `g_m1` int(10) unsigned NOT NULL,
  `g_m2` int(10) unsigned NOT NULL,
  `g_g1` int(10) unsigned NOT NULL,
  `g_g2` int(10) unsigned NOT NULL,
  `g_location` int(10) unsigned NOT NULL,
  `g_date` date NOT NULL,
  `g_time` time NOT NULL,
  PRIMARY KEY  (`g_id`),
  KEY `g_location` (`g_location`),
  KEY `g_m1` (`g_m1`,`g_m2`),
  KEY `g_m2` (`g_m2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- 
-- Daten für Tabelle `games`
-- 


-- --------------------------------------------------------

-- 
-- Tabellenstruktur für Tabelle `groups`
-- 

DROP TABLE IF EXISTS `groups`;
CREATE TABLE IF NOT EXISTS `groups` (
  `g_id` int(10) unsigned NOT NULL auto_increment,
  `g_name` char(1) default NULL,
  PRIMARY KEY  (`g_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- 
-- Daten für Tabelle `groups`
-- 

INSERT INTO `groups` (`g_id`, `g_name`) VALUES (1, 'A'),
(2, 'B'),
(3, 'C'),
(4, 'D'),
(5, 'E'),
(6, 'F'),
(7, 'G'),
(8, 'H');

-- --------------------------------------------------------

-- 
-- Tabellenstruktur für Tabelle `locations`
-- 

DROP TABLE IF EXISTS `locations`;
CREATE TABLE IF NOT EXISTS `locations` (
  `l_id` int(10) unsigned NOT NULL auto_increment,
  `l_name` varchar(255) default NULL,
  PRIMARY KEY  (`l_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- 
-- Daten für Tabelle `locations`
-- 


-- --------------------------------------------------------

-- 
-- Tabellenstruktur für Tabelle `teams`
-- 

DROP TABLE IF EXISTS `teams`;
CREATE TABLE IF NOT EXISTS `teams` (
  `t_id` int(10) unsigned NOT NULL auto_increment,
  `t_name` varchar(255) default NULL,
  `t_group` int(10) unsigned NOT NULL,
  PRIMARY KEY  (`t_id`),
  KEY `t_name` (`t_name`),
  KEY `t_group` (`t_group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- 
-- Constraints der exportierten Tabellen
-- 

-- 
-- Constraints der Tabelle `games`
-- 
ALTER TABLE `games`
  ADD CONSTRAINT `games_ibfk_4` FOREIGN KEY (`g_m1`) REFERENCES `teams` (`t_id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `games_ibfk_5` FOREIGN KEY (`g_m2`) REFERENCES `teams` (`t_id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `games_ibfk_6` FOREIGN KEY (`g_location`) REFERENCES `locations` (`l_id`) ON UPDATE CASCADE;

-- 
-- Constraints der Tabelle `teams`
-- 
ALTER TABLE `teams`
  ADD CONSTRAINT `teams_ibfk_1` FOREIGN KEY (`t_group`) REFERENCES `groups` (`g_id`) ON UPDATE CASCADE;

SET FOREIGN_KEY_CHECKS=1;

COMMIT;