-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Sep 16, 2025 at 11:12 AM
-- Server version: 8.2.0
-- PHP Version: 8.2.13

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: `zdravlje2025`
--
CREATE DATABASE IF NOT EXISTS `zdravlje2025` DEFAULT CHARACTER SET utf16 COLLATE utf16_bin;
USE `zdravlje2025`;

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

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

DROP TABLE IF EXISTS `korisnici`;
CREATE TABLE IF NOT EXISTS `korisnici` (
  `kor_ime` varchar(45) COLLATE utf16_bin NOT NULL,
  `lozinka` varchar(45) COLLATE utf16_bin NOT NULL,
  `ime` varchar(45) COLLATE utf16_bin NOT NULL,
  `prezime` varchar(45) COLLATE utf16_bin NOT NULL,
  `mejl` varchar(45) COLLATE utf16_bin NOT NULL,
  `tip` varchar(45) COLLATE utf16_bin NOT NULL,
  PRIMARY KEY (`kor_ime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf16 COLLATE=utf16_bin;

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

INSERT INTO `korisnici` (`kor_ime`, `lozinka`, `ime`, `prezime`, `mejl`, `tip`) VALUES
('jeca', 'jeca123', 'Jelena', 'Jelic', 'jeca@gmail.com', 'kupac'),
('jova', 'jova123', 'Jovan', 'Jovanovic', 'jova@gmail.com', 'kupac'),
('maja', 'maja123', 'Maja', 'Majic', 'maja@gmail.com', 'radnik'),
('pera', 'pera123', 'Petar', 'Petrovic', 'pera@gmail.com', 'kupac');

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

--
-- Table structure for table `narudzbine`
--

DROP TABLE IF EXISTS `narudzbine`;
CREATE TABLE IF NOT EXISTS `narudzbine` (
  `idN` int NOT NULL AUTO_INCREMENT,
  `kupac` varchar(45) COLLATE utf16_bin NOT NULL,
  `proizvod` int NOT NULL,
  `kolicina` int NOT NULL,
  PRIMARY KEY (`idN`),
  KEY `kupac` (`kupac`),
  KEY `proizvod` (`proizvod`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf16 COLLATE=utf16_bin;

--
-- Dumping data for table `narudzbine`
--

INSERT INTO `narudzbine` (`idN`, `kupac`, `proizvod`, `kolicina`) VALUES
(1, 'pera', 1, 2),
(2, 'jova', 2, 5);

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

--
-- Table structure for table `proizvodi`
--

DROP TABLE IF EXISTS `proizvodi`;
CREATE TABLE IF NOT EXISTS `proizvodi` (
  `idP` int NOT NULL AUTO_INCREMENT,
  `naziv` varchar(45) COLLATE utf16_bin NOT NULL,
  `namena` varchar(45) COLLATE utf16_bin NOT NULL,
  `podrucje` varchar(45) COLLATE utf16_bin NOT NULL,
  `ocena` float NOT NULL,
  PRIMARY KEY (`idP`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf16 COLLATE=utf16_bin;

--
-- Dumping data for table `proizvodi`
--

INSERT INTO `proizvodi` (`idP`, `naziv`, `namena`, `podrucje`, `ocena`) VALUES
(1, 'Maticnjak', 'za opustanje', 'Rtanj', 4.2),
(2, 'Majcina dusica', 'antiseptik i jacanje imuniteta', 'Ozren', 4.6),
(3, 'Nana', 'za stomačne probleme', 'Tara', 4.4),
(4, 'Hajducka trava', 'za zalečenje rana', 'Tara', 4.2);

--
-- Constraints for dumped tables
--

--
-- Constraints for table `narudzbine`
--
ALTER TABLE `narudzbine`
  ADD CONSTRAINT `narudzbine_ibfk_1` FOREIGN KEY (`kupac`) REFERENCES `korisnici` (`kor_ime`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  ADD CONSTRAINT `narudzbine_ibfk_2` FOREIGN KEY (`proizvod`) REFERENCES `proizvodi` (`idP`) ON DELETE RESTRICT ON UPDATE RESTRICT;
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 */;
