-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Aug 22, 2022 at 05:13 PM
-- Server version: 8.0.21
-- PHP Version: 7.4.9

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
SET @@global.time_zone='+00:00';
SET @@session.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 utf8mb4 */;

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

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

--
-- Table structure for table `discipline`
--

DROP TABLE IF EXISTS `discipline`;
CREATE TABLE IF NOT EXISTS `discipline` (
  `disciplina` varchar(100) NOT NULL,
  PRIMARY KEY (`disciplina`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `discipline`
--

INSERT INTO `discipline` (`disciplina`) VALUES
('bacanje koplja zensko'),
('skok u dalj zenski'),
('troskok zenski');

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

--
-- Table structure for table `moderatori`
--

DROP TABLE IF EXISTS `moderatori`;
CREATE TABLE IF NOT EXISTS `moderatori` (
  `korisnicko_ime` varchar(50) NOT NULL,
  `lozinka` varchar(50) NOT NULL,
  `ime` varchar(50) NOT NULL,
  `prezime` varchar(50) NOT NULL,
  `disciplina` varchar(100) NOT NULL,
  PRIMARY KEY (`korisnicko_ime`),
  KEY `fk_dis` (`disciplina`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `moderatori`
--

INSERT INTO `moderatori` (`korisnicko_ime`, `lozinka`, `ime`, `prezime`, `disciplina`) VALUES
('mara', 'mara123', 'Marija', 'Maric', 'skok u dalj zenski'),
('mika', 'mika123', 'Milan', 'Milovanovic', 'troskok zenski'),
('pera', 'pera123', 'Petar', 'Peric', 'bacanje koplja zensko');

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

--
-- Table structure for table `rezultati`
--

DROP TABLE IF EXISTS `rezultati`;
CREATE TABLE IF NOT EXISTS `rezultati` (
  `id` int NOT NULL AUTO_INCREMENT,
  `disciplina` varchar(100) NOT NULL,
  `takmicar_broj` int NOT NULL,
  `serija` int NOT NULL,
  `rezultat` varchar(10) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_disc_rez` (`disciplina`),
  KEY `fk_tak_rez` (`takmicar_broj`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `rezultati`
--

INSERT INTO `rezultati` (`id`, `disciplina`, `takmicar_broj`, `serija`, `rezultat`) VALUES
(1, 'bacanje koplja zensko', 2010, 1, '55.14'),
(2, 'bacanje koplja zensko', 1817, 1, '60.57'),
(3, 'bacanje koplja zensko', 1799, 1, '65.81'),
(4, 'bacanje koplja zensko', 1997, 1, '53.79'),
(5, 'bacanje koplja zensko', 1559, 1, '60.31'),
(6, 'bacanje koplja zensko', 2010, 2, '59.64'),
(7, 'bacanje koplja zensko', 1817, 2, '55.14'),
(8, 'bacanje koplja zensko', 1799, 2, 'X'),
(9, 'bacanje koplja zensko', 1997, 2, '59.36'),
(10, 'bacanje koplja zensko', 1559, 2, 'X'),
(11, 'bacanje koplja zensko', 1997, 3, '53.79'),
(12, 'bacanje koplja zensko', 1559, 3, '60.68'),
(13, 'bacanje koplja zensko', 2010, 3, '62.01'),
(14, 'bacanje koplja zensko', 1817, 3, '57.29'),
(15, 'bacanje koplja zensko', 1799, 3, '64.59'),
(16, 'skok u dalj zenski', 2011, 1, '7.06'),
(17, 'skok u dalj zenski', 1714, 1, '6.69'),
(18, 'skok u dalj zenski', 1759, 1, '6.71'),
(19, 'skok u dalj zenski', 2005, 1, '6.62'),
(20, 'skok u dalj zenski', 2011, 2, '6.96'),
(21, 'troskok zenski', 1759, 1, '14.81'),
(22, 'troskok zenski', 1759, 2, '14.22'),
(23, 'troskok zenski', 2011, 1, '14.51');

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

--
-- Table structure for table `takmicari`
--

DROP TABLE IF EXISTS `takmicari`;
CREATE TABLE IF NOT EXISTS `takmicari` (
  `broj` int NOT NULL,
  `ime` varchar(100) NOT NULL,
  `lozinka` varchar(50) NOT NULL,
  `drzava` varchar(100) NOT NULL,
  PRIMARY KEY (`broj`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `takmicari`
--

INSERT INTO `takmicari` (`broj`, `ime`, `lozinka`, `drzava`) VALUES
(1559, 'SPOTAKOVA Barbora', 'barbora123', 'Czech Republic'),
(1714, 'SAWYERS Jazmin', 'jazmin123', 'Great Britain'),
(1759, 'MIHAMBO Malaika', 'malaika123', 'Germany'),
(1799, 'TZENGKO Elina', 'elina123', 'Greece'),
(1817, 'SZILAGYI Reka', 'reka123', 'Hungary'),
(1997, 'RATEJ Martina', 'martina123', 'Greece'),
(2005, 'GARDASEVIC Milica', 'milica123', 'Serbia'),
(2010, 'VILAGOS Adriana', 'adriana123', 'Serbia'),
(2011, 'VULETA Ivana', 'ivana123', 'Serbia'),
(2070, 'BEKH-ROMANCHUK Maryna', 'maryna123', 'Ukraine');

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

--
-- Table structure for table `takmicar_disciplina`
--

DROP TABLE IF EXISTS `takmicar_disciplina`;
CREATE TABLE IF NOT EXISTS `takmicar_disciplina` (
  `id` int NOT NULL AUTO_INCREMENT,
  `takmicar` int NOT NULL,
  `disciplina` varchar(100) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_disc` (`disciplina`),
  KEY `fk_tak` (`takmicar`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `takmicar_disciplina`
--

INSERT INTO `takmicar_disciplina` (`id`, `takmicar`, `disciplina`) VALUES
(1, 1799, 'bacanje koplja zensko'),
(2, 2010, 'bacanje koplja zensko'),
(3, 1559, 'bacanje koplja zensko'),
(4, 1817, 'bacanje koplja zensko'),
(5, 1997, 'bacanje koplja zensko'),
(6, 2011, 'troskok zenski'),
(7, 1714, 'troskok zenski'),
(8, 1759, 'troskok zenski'),
(9, 2005, 'troskok zenski'),
(10, 2070, 'troskok zenski'),
(11, 1799, 'troskok zenski'),
(12, 2011, 'skok u dalj zenski'),
(13, 1714, 'skok u dalj zenski'),
(14, 1759, 'skok u dalj zenski'),
(15, 2005, 'skok u dalj zenski'),
(16, 2070, 'skok u dalj zenski');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `moderatori`
--
ALTER TABLE `moderatori`
  ADD CONSTRAINT `fk_dis` FOREIGN KEY (`disciplina`) REFERENCES `discipline` (`disciplina`) ON DELETE RESTRICT ON UPDATE RESTRICT;

--
-- Constraints for table `rezultati`
--
ALTER TABLE `rezultati`
  ADD CONSTRAINT `fk_disc_rez` FOREIGN KEY (`disciplina`) REFERENCES `discipline` (`disciplina`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  ADD CONSTRAINT `fk_tak_rez` FOREIGN KEY (`takmicar_broj`) REFERENCES `takmicari` (`broj`) ON DELETE RESTRICT ON UPDATE RESTRICT;

--
-- Constraints for table `takmicar_disciplina`
--
ALTER TABLE `takmicar_disciplina`
  ADD CONSTRAINT `fk_disc` FOREIGN KEY (`disciplina`) REFERENCES `discipline` (`disciplina`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  ADD CONSTRAINT `fk_tak` FOREIGN KEY (`takmicar`) REFERENCES `takmicari` (`broj`) ON DELETE RESTRICT ON UPDATE RESTRICT;
COMMIT;

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