-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jun 19, 2021 at 07:23 AM
-- Server version: 5.7.19
-- PHP Version: 7.1.9

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: `dezurtsva2021`
--
CREATE DATABASE IF NOT EXISTS `dezurstva2021` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `dezurstva2021`;
-- --------------------------------------------------------

--
-- Table structure for table `korisnici`
--

DROP TABLE IF EXISTS `korisnici`;
CREATE TABLE IF NOT EXISTS `korisnici` (
  `korisnickoIme` varchar(50) NOT NULL,
  `lozinka` varchar(50) NOT NULL,
  `ime` varchar(50) NOT NULL,
  `prezime` varchar(50) NOT NULL,
  `tip` varchar(15) NOT NULL,
  PRIMARY KEY (`korisnickoIme`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `korisnici`
--

INSERT INTO `korisnici` (`korisnickoIme`, `lozinka`, `ime`, `prezime`, `tip`) VALUES
('danko', 'danko123', 'Danko', 'Miladinovic', 'nastavnik'),
('dj', 'dj123', 'Jovan', 'Djukic', 'nastavnik'),
('drazen', 'drazen123', 'Drazen', 'Draskovic', 'nastavnik'),
('jelica', 'jelica123', 'Jelica', 'Cincovic', 'nastavnik'),
('jocke', 'jocke123', 'Vladimir', 'Jocovic', 'nastavnik'),
('micko', 'micko123', 'Marko', 'Micovic', 'nastavnik'),
('sanja', 'sanja123', 'Sanja', 'Delcev', 'nastavnik'),
('tasha', 'tasha123', 'Tamara', 'Sekularac', 'nastavnik'),
('uki', 'uki123', 'Uros', 'Radenkovic', 'nastavnik');


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

--
-- Table structure for table `dezurstva`
--

DROP TABLE IF EXISTS `dezurstva`;
CREATE TABLE IF NOT EXISTS `dezurstva` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `datumVreme` datetime NOT NULL,
  `predmet` varchar(75) NOT NULL,
  `sala` varchar(25) NOT NULL,
  `nastavnik` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `nastavnik` (`nastavnik`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `dezurstva`
--

INSERT INTO `dezurstva` (`id`, `datumVreme`, `predmet`, `sala`, `nastavnik`) VALUES
(1, '2021-06-30 15:00:00', 'Zastita podataka', 'P26', 'sanja'),
(2, '2021-06-30 15:00:00', 'Zastita podataka', '60', 'jelica'),
(3, '2021-06-30 15:00:00', 'Zastita podataka', 'P25', 'dj'),
(4, '2021-06-30 15:00:00', 'Zastita podataka', '70', 'uki'),
(5, '2021-06-30 15:00:00', 'Zastita podataka', '70', 'jocke'),
(6, '2021-07-07 11:30:00', 'Programiranje 2', '56', 'sanja'),
(7, '2021-07-07 11:30:00', 'Programiranje 2', '65', 'drazen'),
(8, '2021-07-07 11:30:00', 'Programiranje 2', '59', 'jelica'),
(10, '2021-07-06 15:00:00', 'Konkurentno i distribuirano programiranje', '56', 'micko'),
(11, '2021-07-02 15:00:00', 'Osnovi racunarske tehnike', '56', 'micko'),
(12, '2021-07-02 15:00:00', 'Osnovi racunarske tehnike', '57', 'uki'),
(13, '2021-07-02 15:00:00', 'Osnovi racunarske tehnike', '59', 'jocke'),
(14, '2021-07-02 15:00:00', 'Osnovi racunarske tehnike', 'Lola-AMF', 'dj'),
(15, '2021-07-04 08:00:00', 'Operativni sistemi 1', '56', 'dj'),
(16, '2021-07-04 08:00:00', 'Operativni sistemi 1', '57', 'sanja'),
(17, '2021-07-04 08:00:00', 'Operativni sistemi 1', '59', 'drazen'),
(18, '2021-07-04 08:00:00', 'Operativni sistemi 1', '62', 'jocke'),
(19, '2021-07-04 08:00:00', 'Operativni sistemi 1', '65', 'danko');

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

--
-- Table structure for table `zamene`
--

DROP TABLE IF EXISTS `zamene`;
CREATE TABLE IF NOT EXISTS `zamene` (
  `dezurstvoMoje` int(11) NOT NULL,
  `dezurstvoZeljeno` int(11) NOT NULL,
  KEY `dezurstvoMoje` (`dezurstvoMoje`),
  KEY `dezurstvoZeljeno` (`dezurstvoZeljeno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `zamene`
--

INSERT INTO `zamene` (`dezurstvoMoje`, `dezurstvoZeljeno`) VALUES
(16, 8),
(4, 8),
(1, 12);

--
-- Constraints for dumped tables
--

--
-- Constraints for table `dezurstva`
--
ALTER TABLE `dezurstva`
  ADD CONSTRAINT `fk_nastavnik_dezurstvo` FOREIGN KEY (`nastavnik`) REFERENCES `korisnici` (`korisnickoIme`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `zamene`
--
ALTER TABLE `zamene`
  ADD CONSTRAINT `zamene_ibfk_1` FOREIGN KEY (`dezurstvoMoje`) REFERENCES `dezurstva` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `zamene_ibfk_2` FOREIGN KEY (`dezurstvoZeljeno`) REFERENCES `dezurstva` (`id`) 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 */;
