-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Nov 17, 2022 at 10:21 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";


/*!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: `etfdiplomci`
--
CREATE DATABASE IF NOT EXISTS `etfdiplomci` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
USE `etfdiplomci`;

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

--
-- Table structure for table `diplomski`
--

DROP TABLE IF EXISTS `diplomski`;
CREATE TABLE IF NOT EXISTS `diplomski` (
  `student` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `naslov` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `opis` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `mentor` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `ocena` int DEFAULT NULL,
  PRIMARY KEY (`student`),
  KEY `korisnik2` (`mentor`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- Dumping data for table `diplomski`
--

INSERT INTO `diplomski` (`student`, `naslov`, `opis`, `mentor`, `ocena`) VALUES
('mica', 'Diplomski rad 1', 'Opis diplomskog rada', 'drazen', NULL),
('mirko', 'Diplomski rad 2', 'Diplomski rad o vestackoj inteligenciji', 'drazen', 10);

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

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

DROP TABLE IF EXISTS `korisnici`;
CREATE TABLE IF NOT EXISTS `korisnici` (
  `korisnicko_ime` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `lozinka` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `ime` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `prezime` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `tip` int NOT NULL COMMENT '0 - student, 1 - nastavnik',
  PRIMARY KEY (`korisnicko_ime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

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

INSERT INTO `korisnici` (`korisnicko_ime`, `lozinka`, `ime`, `prezime`, `tip`) VALUES
('drazen', 'drazen123', 'Drazen', 'Draskovic', 1),
('jelica', 'jelica123', 'Jelica', 'Cincovic', 1),
('jova', 'jova123', 'Jovan', 'Jovic', 0),
('laza', 'laza123', 'Lazar', 'Lazarevic', 0),
('mica', 'mica123', 'Milica', 'Milicevic', 0),
('mirko', 'mirko123', 'Mirko', 'Mirkovic', 0),
('sanja', 'sanja123', 'Sanja', 'Delcev', 1);

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

--
-- Table structure for table `podaci`
--

DROP TABLE IF EXISTS `podaci`;
CREATE TABLE IF NOT EXISTS `podaci` (
  `student` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `bodovi` int NOT NULL,
  PRIMARY KEY (`student`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- Dumping data for table `podaci`
--

INSERT INTO `podaci` (`student`, `bodovi`) VALUES
('jova', 210),
('laza', 230),
('mica', 230),
('mirko', 230);

--
-- Constraints for dumped tables
--

--
-- Constraints for table `diplomski`
--
ALTER TABLE `diplomski`
  ADD CONSTRAINT `korisnik1` FOREIGN KEY (`student`) REFERENCES `korisnici` (`korisnicko_ime`),
  ADD CONSTRAINT `korisnik2` FOREIGN KEY (`mentor`) REFERENCES `korisnici` (`korisnicko_ime`);

--
-- Constraints for table `podaci`
--
ALTER TABLE `podaci`
  ADD CONSTRAINT `student` FOREIGN KEY (`student`) REFERENCES `korisnici` (`korisnicko_ime`);
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 */;
