-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jan 11, 2016 at 10:22 PM
-- 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: `turista2016`
--
CREATE DATABASE IF NOT EXISTS `turista2016` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `turista2016`;

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

--
-- Table structure for table `aranzman`
--

DROP TABLE IF EXISTS `aranzman`;
CREATE TABLE IF NOT EXISTS `aranzman` (
  `idaranzmana` int(11) NOT NULL AUTO_INCREMENT,
  `mesto` varchar(32) NOT NULL,
  `datum_pocetka` date NOT NULL,
  `broj_dana` int(11) NOT NULL,
  `opis_aranzmana` varchar(150) NOT NULL,
  `cena` double NOT NULL,
  `id_radnika_agencije` varchar(16) NOT NULL,
  PRIMARY KEY (`idaranzmana`),
  KEY `id_radnika_agencije` (`id_radnika_agencije`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;

--
-- Dumping data for table `aranzman`
--

INSERT INTO `aranzman` (`idaranzmana`, `mesto`, `datum_pocetka`, `broj_dana`, `opis_aranzmana`, `cena`, `id_radnika_agencije`) VALUES
(1, 'London', '2016-01-22', 7, 'Obilazak britanskog parlamenta, kraljevskoj palati, poseta britanskom muzeju, muzeju Madam Tiso,', 650, 'sloba'),
(2, 'Pariz', '2016-01-27', 5, 'Poseta Ajfelovom tornju, muzejima Versaj i Luvr', 600, 'pera'),
(3, 'London', '2016-01-27', 5, '/', 525, 'pera'),
(4, 'Kuba - Havana i Varadero', '2016-01-31', 15, '', 1190, 'sloba'),
(5, 'Kopaonik', '2016-02-01', 10, 'smestaj u ap. naselju Konaci + ski pass', 395, 'pera'),
(6, 'Berlin', '2016-02-08', 6, 'Poseta Berlinu', 449, 'sloba');

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

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

DROP TABLE IF EXISTS `korisnik`;
CREATE TABLE IF NOT EXISTS `korisnik` (
  `korisnickoime` varchar(16) NOT NULL,
  `lozinka` varchar(16) NOT NULL,
  `ime` varchar(32) NOT NULL,
  `prezime` varchar(32) NOT NULL,
  `jmbg` varchar(13) NOT NULL,
  `eposta` varchar(64) NOT NULL,
  `radnik_agencije` tinyint(1) NOT NULL,
  PRIMARY KEY (`korisnickoime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

INSERT INTO `korisnik` (`korisnickoime`, `lozinka`, `ime`, `prezime`, `jmbg`, `eposta`, `radnik_agencije`) VALUES
('bosko', 'sifra123', 'Boško', 'Nikolić', '0808975712105', 'nbosko@etf.rs', 0),
('drasko', 'sifra123', 'Dražen', 'Drašković', '3112985710105', 'draskovic@etf.rs', 0),
('pera', 'sifra123', 'Petar', 'Go2', '0505965755850', 'petar@go2.rs', 1),
('sloba', 'sifra123', 'Slobodan', 'Kontiki', '1010945745850', 'sloba@kontiki.rs', 1);

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

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

DROP TABLE IF EXISTS `rezervacija`;
CREATE TABLE IF NOT EXISTS `rezervacija` (
  `idrezervacije` int(11) NOT NULL AUTO_INCREMENT,
  `korisnickoime` varchar(16) NOT NULL,
  `idaranzmana` int(11) NOT NULL,
  `vreme_rezervacije` datetime NOT NULL,
  PRIMARY KEY (`idrezervacije`),
  KEY `korisnickoime` (`korisnickoime`,`idaranzmana`),
  KEY `idaranzmana` (`idaranzmana`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

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

INSERT INTO `rezervacija` (`idrezervacije`, `korisnickoime`, `idaranzmana`, `vreme_rezervacije`) VALUES
(1, 'bosko', 3, '2016-01-05 10:30:00'),
(2, 'drasko', 5, '2016-01-08 12:20:00');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `aranzman`
--
ALTER TABLE `aranzman`
  ADD CONSTRAINT `aranzman_ibfk_1` FOREIGN KEY (`id_radnika_agencije`) REFERENCES `korisnik` (`korisnickoime`) ON DELETE CASCADE ON UPDATE CASCADE;

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