-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 10, 2014 at 01:35 AM
-- Server version: 5.5.24-log
-- PHP Version: 5.4.3

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: `teatar`
--
CREATE DATABASE `teatar` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `teatar`;

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

--
-- Table structure for table `korisnik`
--

CREATE TABLE IF NOT EXISTS `korisnik` (
  `username` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
  `ime` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
  `prezime` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
  `telefon` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
  `kategorija` tinyint(4) NOT NULL,
  PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `korisnik`
--

INSERT INTO `korisnik` (`username`, `password`, `ime`, `prezime`, `telefon`, `email`, `kategorija`) VALUES
('admin', 'sifra123', 'Admin', 'Adminovic', '011/1112233', 'admin@etf.rs', 1),
('bosko', 'sifra123', 'Bosko', 'Nikolic', '011/2013800', 'nbosko@etf.rs', 0),
('drasko', 'sifra123', 'Drazen', 'Draskovic', '011/5557733', 'draskovic@etf.rs', 0),
('nemanja', 'sifra123', 'Nemanja', 'Kojic', '011/2013700', 'nkojic@etf.rs', 0);

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

--
-- Table structure for table `pozoriste`
--

CREATE TABLE IF NOT EXISTS `pozoriste` (
  `idpoz` int(11) NOT NULL AUTO_INCREMENT,
  `naziv` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `adresa` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `telefon` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`idpoz`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ;

--
-- Dumping data for table `pozoriste`
--

INSERT INTO `pozoriste` (`idpoz`, `naziv`, `adresa`, `telefon`) VALUES
(1, 'Atelje 212', 'Svetogorska 21', '011/3247-342'),
(2, 'Zvezdara', 'Milana Rakica 38', '011/2414-527'),
(3, 'JDP', 'Kralja Milana 50', '011/3061-957'),
(4, 'BDP', 'Milesevska 64', '011/2423-686');

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

--
-- Table structure for table `predstava`
--

CREATE TABLE IF NOT EXISTS `predstava` (
  `idpred` int(11) NOT NULL AUTO_INCREMENT,
  `naziv` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `rezija` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `glumci` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `datum` date NOT NULL,
  `pozoriste` int(11) NOT NULL,
  PRIMARY KEY (`idpred`),
  KEY `pozoriste` (`pozoriste`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=11 ;

--
-- Dumping data for table `predstava`
--

INSERT INTO `predstava` (`idpred`, `naziv`, `rezija`, `glumci`, `datum`, `pozoriste`) VALUES
(1, 'Ljubavno pismo', 'Branko Kicic', 'Miodrag Krstovic, Tatjana Boskovic, Dubravka Mijatovic, Branislav Zereminski, Gordan Kicic', '2014-02-09', 1),
(2, 'Trst', 'Alisa Stojanovic', 'Branka Petric, Fedja Stojanovic, Jelisaveta Sablic, Branislav Zereminski, Svetozar Cvetkovic, Isidora Minic', '2014-02-14', 1),
(3, 'Sveti Georgije ubiva azdahu', 'Ljubomir Draskic', 'Bojan Zirovic, Sofija Jurican, Marinko Madzgalj, Caci Mihailovic, Gordan Kicic', '2014-02-11', 1),
(4, 'Kumovi', 'Dusan Kovacevic', 'Danica Maksimovic, Miki Manojlovic, Branimir Brstina', '2014-02-11', 2),
(5, 'Dzuboks', 'Dragan Jovanovic', 'Dragan Jovanovic, Veljko Nikolic', '2014-02-11', 2),
(6, 'Suze su OK', 'Milan Karadzic', 'Tatjana Boskovic, Rade Marjanovic, Ivan Jeftovic, Caci Mihajlovic', '2014-03-15', 2),
(7, 'Dobrodosli u Srbiju', 'Dragan Jovanovic', 'Dragan Jovanovic, Branka Pujic', '2014-02-24', 2),
(8, 'Zivot u tesnim cipelama', 'Dusan Kovacevic', 'Nenad Jezdic, Biljana Djurovic, Slobodan Ninkovic, Dragan Petrovic, Ljiljana Dragutinovic, Milorad Mandic', '2014-02-15', 2),
(9, 'Let iznad kukavicjeg gnezda', 'Zanko Tomic', 'Dragan Bjelogrlic, Milorad Mandic, Boda Ninkovic, Boris Komnenic, Fedja Stojanovic', '2014-02-13', 4),
(10, 'Sumnjivo lice', 'Jagos Markovic', 'Nebojsa Glogovac, Jelisaveta Sablic, Dragan Micanovic, Vlasta Velisavljevic', '2014-02-12', 3);

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

--
-- Table structure for table `rezervacija`
--

CREATE TABLE IF NOT EXISTS `rezervacija` (
  `idrez` int(11) NOT NULL AUTO_INCREMENT,
  `korisnik` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
  `predstava` int(11) NOT NULL,
  `broj_ulaznica` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idrez`),
  KEY `korisnik` (`korisnik`),
  KEY `predstava` (`predstava`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7 ;

--
-- Dumping data for table `rezervacija`
--

INSERT INTO `rezervacija` (`idrez`, `korisnik`, `predstava`, `broj_ulaznica`) VALUES
(1, 'bosko', 1, 2),
(2, 'bosko', 9, 1),
(3, 'drasko', 6, 2),
(4, 'drasko', 7, 4),
(5, 'nemanja', 3, 1),
(6, 'nemanja', 8, 3);

--
-- Constraints for dumped tables
--

--
-- Constraints for table `predstava`
--
ALTER TABLE `predstava`
  ADD CONSTRAINT `predstava_ibfk_1` FOREIGN KEY (`pozoriste`) REFERENCES `pozoriste` (`idpoz`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `rezervacija`
--
ALTER TABLE `rezervacija`
  ADD CONSTRAINT `rezervacija_ibfk_2` FOREIGN KEY (`korisnik`) REFERENCES `korisnik` (`username`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `rezervacija_ibfk_1` FOREIGN KEY (`predstava`) REFERENCES `predstava` (`idpred`) 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 */;
