-- phpMyAdmin SQL Dump
-- version 4.7.9
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jul 09, 2018 at 09:49 PM
-- Server version: 5.7.21
-- PHP Version: 7.2.4

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
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 utf8mb4 */;

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

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

--
-- Table structure for table `film`
--

DROP TABLE IF EXISTS `film`;
CREATE TABLE IF NOT EXISTS `film` (
  `idFilma` int(11) NOT NULL AUTO_INCREMENT,
  `naziv_original` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `naziv_eng` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `zanr` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `zemlja` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `jezik` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `reziser` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `trajanje` int(11) NOT NULL,
  `godina_izdanja` int(11) NOT NULL,
  PRIMARY KEY (`idFilma`),
  KEY `zemlja` (`zemlja`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Table structure for table `gleda`
--

DROP TABLE IF EXISTS `gleda`;
CREATE TABLE IF NOT EXISTS `gleda` (
  `username` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `idprojekcije` int(11) NOT NULL,
  `ocena` int(11) NOT NULL,
  PRIMARY KEY (`username`,`idprojekcije`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

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

DROP TABLE IF EXISTS `korisnik`;
CREATE TABLE IF NOT EXISTS `korisnik` (
  `username` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `jmbg` int(13) NOT NULL,
  `ime` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `prezime` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Table structure for table `lokacija`
--

DROP TABLE IF EXISTS `lokacija`;
CREATE TABLE IF NOT EXISTS `lokacija` (
  `idLokacije` int(11) NOT NULL AUTO_INCREMENT,
  `naziv` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `adresa` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
  `brojRaspolozivihMesta` int(11) NOT NULL,
  PRIMARY KEY (`idLokacije`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Table structure for table `projekcija`
--

DROP TABLE IF EXISTS `projekcija`;
CREATE TABLE IF NOT EXISTS `projekcija` (
  `idProjekcije` int(11) NOT NULL AUTO_INCREMENT,
  `idFilma` int(11) NOT NULL,
  `idLokacije` int(11) NOT NULL,
  `datum` date NOT NULL,
  `vreme` time NOT NULL,
  PRIMARY KEY (`idProjekcije`),
  KEY `idFilma` (`idFilma`),
  KEY `idLokacije` (`idLokacije`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Table structure for table `zemlja`
--

DROP TABLE IF EXISTS `zemlja`;
CREATE TABLE IF NOT EXISTS `zemlja` (
  `nazivZemlje` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`nazivZemlje`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `zemlja`
--
ALTER TABLE `zemlja`
  ADD CONSTRAINT `zemlja_ibfk_1` FOREIGN KEY (`nazivZemlje`) REFERENCES `film` (`zemlja`) ON DELETE CASCADE ON UPDATE CASCADE;
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 */;
