-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jun 28, 2016 at 01:56 AM
-- Server version: 5.6.17
-- PHP Version: 5.5.12

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 */;

--
-- Database: `kvalifikacijeoi2016`
--
CREATE DATABASE IF NOT EXISTS `kvalifikacijeoi2016` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `kvalifikacijeoi2016`;

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

--
-- Table structure for table `igrac`
--

DROP TABLE IF EXISTS `igrac`;
CREATE TABLE IF NOT EXISTS `igrac` (
  `idigraca` int(11) NOT NULL AUTO_INCREMENT,
  `ime` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `prezime` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `ekipa` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`idigraca`),
  KEY `ekipa` (`ekipa`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=40 ;

--
-- Dumping data for table `igrac`
--

INSERT INTO `igrac` (`idigraca`, `ime`, `prezime`, `ekipa`) VALUES
(1, 'Milos', 'Teodosic', 'Srbija'),
(2, 'Bogdan', 'Bogdanovic', 'Srbija'),
(3, 'Nemanja', 'Bjelica', 'Srbija'),
(4, 'Stefan', 'Jovic', 'Srbija'),
(5, 'Nikola', 'Jokic', 'Srbija'),
(6, 'Vassilis', 'Spanoulis', 'Grcka'),
(7, 'Dimitris', 'Diamantidis', 'Grcka'),
(8, 'Ioannis', 'Bourousis', 'Grcka'),
(9, 'Georgios', 'Printezis', 'Grcka'),
(10, 'Antonis', 'Fotsis', 'Grcka'),
(11, 'Nando', 'De Colo', 'Francuska'),
(12, 'Nicolas', 'Batum', 'Francuska'),
(13, 'Boris', 'Diaw', 'Francuska'),
(14, 'Jan', 'Vesely', 'Ceska republika'),
(15, 'Blake', 'Schilb', 'Ceska republika'),
(16, 'Carlos', 'Arroyo', 'Portoriko'),
(17, 'Renaldo', 'Balkman', 'Portoriko'),
(18, 'Jose', 'Juan Barea', 'Portoriko'),
(19, 'Dairis', 'Bertans', 'Letonija'),
(20, 'Mareks', 'Mejiris', 'Letonija'),
(21, 'Daniel', 'Hackett', 'Italija'),
(22, 'Alessandro', 'Gentile', 'Italija'),
(23, 'Luigi', 'Datome', 'Italija'),
(24, 'Ricardo', 'Cervi', 'Italija'),
(25, 'Jonas', 'Maciulis', 'Litvanija'),
(26, 'Paulius', 'Jankunas', 'Litvanija'),
(27, 'Pau', 'Gasol', 'Spanija'),
(28, 'Rudy', 'Fernandez', 'Spanija'),
(29, 'Juan', 'Navarro', 'Spanija'),
(30, 'Sergio', 'Rodrigez', 'Spanija'),
(31, 'Manu', 'Ginobili', 'Argentina'),
(32, 'Andres', 'Nocioni', 'Argentina'),
(33, 'Luis', 'Scola', 'Argentina'),
(34, 'Patricio', 'Garino', 'Argentina'),
(35, 'Bojan', 'Bogdanovic', 'Hrvatska'),
(36, 'Roko', 'Ukic', 'Hrvatska'),
(37, 'Dario', 'Saric', 'Hrvatska'),
(38, 'Wang', 'Zhelin', 'Kina'),
(39, 'Zhou', 'Qi', 'Kina');

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

--
-- Table structure for table `mvp`
--

DROP TABLE IF EXISTS `mvp`;
CREATE TABLE IF NOT EXISTS `mvp` (
  `idutakmica` int(11) NOT NULL,
  `idigrac` int(11) NOT NULL,
  `points` int(11) NOT NULL,
  `assist` int(11) NOT NULL,
  `jump` int(11) NOT NULL,
  PRIMARY KEY (`idutakmica`),
  KEY `idutakmica` (`idutakmica`),
  KEY `idigrac` (`idigrac`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `mvp`
--

INSERT INTO `mvp` (`idutakmica`, `idigrac`, `points`, `assist`, `jump`) VALUES
(1, 1, 26, 11, 8),
(2, 7, 17, 5, 11),
(3, 19, 15, 6, 7),
(4, 27, 22, 2, 15),
(5, 23, 14, 7, 5),
(6, 25, 19, 9, 11),
(7, 5, 20, 8, 10),
(8, 11, 27, 14, 3),
(9, 6, 13, 9, 8),
(10, 25, 21, 7, 6),
(11, 31, 29, 13, 8),
(12, 37, 16, 5, 9),
(13, 1, 35, 13, 10),
(14, 11, 12, 11, 4),
(15, 14, 26, 2, 11);

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

--
-- Table structure for table `tim`
--

DROP TABLE IF EXISTS `tim`;
CREATE TABLE IF NOT EXISTS `tim` (
  `reprezent` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `grupa` varchar(1) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`reprezent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `tim`
--

INSERT INTO `tim` (`reprezent`, `grupa`) VALUES
('Argentina', 'B'),
('Ceska republika', 'A'),
('Francuska', 'A'),
('Grcka', 'A'),
('Hrvatska', 'B'),
('Italija', 'B'),
('Kina', 'B'),
('Letonija', 'A'),
('Litvanija', 'B'),
('Portoriko', 'A'),
('Spanija', 'B'),
('Srbija', 'A');

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

--
-- Table structure for table `utakmica`
--

DROP TABLE IF EXISTS `utakmica`;
CREATE TABLE IF NOT EXISTS `utakmica` (
  `idutakmice` int(11) NOT NULL AUTO_INCREMENT,
  `kolo` int(11) NOT NULL,
  `tim1` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `tim2` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `datum` datetime NOT NULL,
  `poeni_tim1` int(11) NOT NULL,
  `poeni_tim2` int(11) NOT NULL,
  PRIMARY KEY (`idutakmice`),
  KEY `tim1` (`tim1`,`tim2`),
  KEY `tim2` (`tim2`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=16 ;

--
-- Dumping data for table `utakmica`
--

INSERT INTO `utakmica` (`idutakmice`, `kolo`, `tim1`, `tim2`, `datum`, `poeni_tim1`, `poeni_tim2`) VALUES
(1, 1, 'Francuska', 'Srbija', '2016-06-25 17:00:00', 82, 88),
(2, 1, 'Grcka', 'Ceska republika', '2016-06-25 19:00:00', 65, 60),
(3, 1, 'Portoriko', 'Letonija', '2016-06-25 21:00:00', 73, 74),
(4, 1, 'Argentina', 'Spanija', '2016-06-25 17:00:00', 81, 82),
(5, 1, 'Hrvatska', 'Italija', '2016-06-25 19:00:00', 75, 90),
(6, 1, 'Litvanija', 'Kina', '2016-06-25 21:00:00', 79, 76),
(7, 2, 'Srbija', 'Portoriko', '2016-06-26 17:00:00', 88, 60),
(8, 2, 'Francuska', 'Ceska republika', '2016-06-26 19:00:00', 75, 69),
(9, 2, 'Grcka', 'Letonija', '2016-06-26 21:00:00', 64, 62),
(10, 2, 'Spanija', 'Litvanija', '2016-06-26 16:00:00', 77, 84),
(11, 2, 'Argentina', 'Italija', '2016-06-26 18:00:00', 64, 60),
(12, 2, 'Hrvatska', 'Kina', '2016-06-26 20:00:00', 71, 60),
(13, 3, 'Srbija', 'Letonija', '2016-06-27 21:00:00', 101, 89),
(14, 3, 'Francuska', 'Grcka', '2016-06-27 19:00:00', 66, 65),
(15, 3, 'Portoriko', 'Ceska republika', '2016-06-27 17:00:00', 94, 95);

--
-- Constraints for dumped tables
--

--
-- Constraints for table `igrac`
--
ALTER TABLE `igrac`
  ADD CONSTRAINT `igrac_ibfk_1` FOREIGN KEY (`ekipa`) REFERENCES `tim` (`reprezent`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `mvp`
--
ALTER TABLE `mvp`
  ADD CONSTRAINT `mvp_ibfk_1` FOREIGN KEY (`idutakmica`) REFERENCES `utakmica` (`idutakmice`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `mvp_ibfk_2` FOREIGN KEY (`idigrac`) REFERENCES `igrac` (`idigraca`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `utakmica`
--
ALTER TABLE `utakmica`
  ADD CONSTRAINT `utakmica_ibfk_1` FOREIGN KEY (`tim1`) REFERENCES `tim` (`reprezent`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `utakmica_ibfk_2` FOREIGN KEY (`tim2`) REFERENCES `tim` (`reprezent`) ON DELETE CASCADE ON UPDATE CASCADE;

/*!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 */;
