-- phpMyAdmin SQL Dump
-- version 3.5.2.2
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Czas wygenerowania: 09 Kwi 2013, 12:22
-- Wersja serwera: 5.5.27
-- Wersja PHP: 5.4.7

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Baza danych: `koty`
--

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

--
-- Struktura tabeli dla tabeli `bandy`
--

CREATE TABLE IF NOT EXISTS `bandy` (
  `id_b` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nazwa` varchar(40) NOT NULL,
  `id_szefa` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id_b`),
  KEY `id_szefa` (`id_szefa`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Zrzut danych tabeli `bandy`
--

INSERT INTO `bandy` (`id_b`, `nazwa`, `id_szefa`) VALUES
(1, 'dachowce', 3),
(2, 'rakiety', 19),
(3, 'szalone samice', 14);

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

--
-- Struktura tabeli dla tabeli `koty`
--

CREATE TABLE IF NOT EXISTS `koty` (
  `id_k` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `imie` varchar(40) NOT NULL,
  `wiek` int(1) unsigned NOT NULL DEFAULT '2',
  `id_bandy` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id_k`),
  KEY `id_bandy` (`id_bandy`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;

--
-- Zrzut danych tabeli `koty`
--

INSERT INTO `koty` (`id_k`, `imie`, `wiek`, `id_bandy`) VALUES
(1, 'gapcio', 3, 1),
(2, 'fruzia', 12, 1),
(3, 'smykos', 4, 2),
(4, 'lady gada', 5, 3),
(5, 'myszka', 2, 2),
(6, 'gotfryd', 7, 1),
(7, 'marmelada', 2, 3),
(8, 'leopard', 9, 1),
(9, 'szemrak', 12, 1),
(10, 'macius', 23, 1),
(11, 'zdzisio', 9, 1),
(12, 'mruczus', 6, 1),
(13, 'czarnulka', 4, 3),
(14, 'zbyszko', 2, 1),
(15, 'bury', 7, 1),
(16, 'zadziora', 2, 2),
(17, 'franka', 7, 3),
(18, 'malutka', 2, 2),
(19, 'milka', 3, 3),
(20, 'stasiu', 2, 1);

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

--
-- Struktura tabeli dla tabeli `potyczki`
--

CREATE TABLE IF NOT EXISTS `potyczki` (
  `id_b1` int(10) unsigned NOT NULL,
  `id_b2` int(10) unsigned NOT NULL,
  `data` date NOT NULL,
  PRIMARY KEY (`id_b1`,`id_b2`,`data`),
  KEY `id_b1` (`id_b1`),
  KEY `id_b2` (`id_b2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Zrzut danych tabeli `potyczki`
--

INSERT INTO `potyczki` (`id_b1`, `id_b2`, `data`) VALUES
(1, 2, '2013-04-01'),
(1, 2, '2013-04-17'),
(1, 2, '2013-04-19'),
(1, 3, '2013-02-13'),
(1, 3, '2013-03-09'),
(1, 3, '2013-03-24'),
(1, 3, '2013-04-25'),
(1, 3, '2013-04-30'),
(2, 1, '2012-12-11'),
(2, 1, '2013-03-18'),
(2, 1, '2013-04-23'),
(2, 3, '2012-12-04'),
(2, 3, '2013-04-13'),
(2, 3, '2013-04-21'),
(3, 2, '2013-03-13');

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

--
-- Struktura tabeli dla tabeli `zdobycze`
--

CREATE TABLE IF NOT EXISTS `zdobycze` (
  `id_z` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nazwa` varchar(40) NOT NULL,
  `wartosc` int(4) NOT NULL,
  `wlasciciel` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id_z`),
  KEY `wlasciciel` (`wlasciciel`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;

--
-- Zrzut danych tabeli `zdobycze`
--

INSERT INTO `zdobycze` (`id_z`, `nazwa`, `wartosc`, `wlasciciel`) VALUES
(1, 'puszka szprotek', 6, 1),
(2, 'wedzona makrela', 12, 2),
(3, 'medalik', 22, 3),
(4, 'sztuczna mysz', 34, 1),
(5, 'ser', 13, 2),
(6, 'bawik', 34, 3),
(7, 'zapas mleka', 23, 2),
(8, 'paletko', 54, 2),
(9, 'stare skarpety', 1, 1),
(10, 'pilka', 65, 2),
(11, 'ryby', 45, 2),
(12, 'kapsel', 1, 1),
(13, 'buda', 78, 1),
(14, 'obrazek', 11, 2),
(15, 'szyneczka', 89, 3);

--
-- Ograniczenia dla zrzutów tabel
--

--
-- Ograniczenia dla tabeli `bandy`
--
ALTER TABLE `bandy`
  ADD CONSTRAINT `bandy_fk` FOREIGN KEY (`id_szefa`) REFERENCES `koty` (`id_k`);

--
-- Ograniczenia dla tabeli `koty`
--
ALTER TABLE `koty`
  ADD CONSTRAINT `koty_fk` FOREIGN KEY (`id_bandy`) REFERENCES `bandy` (`id_b`);

--
-- Ograniczenia dla tabeli `potyczki`
--
ALTER TABLE `potyczki`
  ADD CONSTRAINT `potyczki_fk2` FOREIGN KEY (`id_b2`) REFERENCES `bandy` (`id_b`),
  ADD CONSTRAINT `potyczki_fk1` FOREIGN KEY (`id_b1`) REFERENCES `bandy` (`id_b`);

--
-- Ograniczenia dla tabeli `zdobycze`
--
ALTER TABLE `zdobycze`
  ADD CONSTRAINT `zdobycze_fk` FOREIGN KEY (`wlasciciel`) REFERENCES `bandy` (`id_b`);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
