-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jul 01, 2023 at 11:59 AM
-- 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: `kafe2023`
--
DROP DATABASE IF EXISTS `kafe2023`;
CREATE DATABASE IF NOT EXISTS `kafe2023` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
USE `kafe2023`;

-- --------------------------------------------------------
--
-- Table structure for table `kafe`
--

DROP TABLE IF EXISTS `kafe`;
CREATE TABLE IF NOT EXISTS `kafe` (
  `idK` int NOT NULL,
  `naziv` varchar(45) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `cena` int NOT NULL,
  PRIMARY KEY (`idK`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- Dumping data for table `kafe`
--

INSERT INTO `kafe` (`idK`, `naziv`, `cena`) VALUES
(1, 'moka', 150),
(2, 'espreso', 100),
(3, 'kapucino', 200);

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

DROP TABLE IF EXISTS `korisnici`;
CREATE TABLE IF NOT EXISTS `korisnici` (
  `ime` varchar(45) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `prezime` varchar(45) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `mejl` varchar(45) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `kor_ime` varchar(45) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `lozinka` varchar(45) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `tip` varchar(45) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `racun` int NOT NULL,
  PRIMARY KEY (`kor_ime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

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

INSERT INTO `korisnici` (`ime`, `prezime`, `mejl`, `kor_ime`, `lozinka`, `tip`, `racun`) VALUES
('Nikolina', 'Kafeterijević', 'admin@admin.com', 'admin', 'admin', 'radnik', 250),
('Pera', 'Perić', 'pera@gmail.com', 'pera', 'pera123', 'kupac', 1500),
('Žika', 'Živković', 'zika@gmail.com', 'zika', 'zika123', 'kupac', 1000);

-- --------------------------------------------------------
--
-- Table structure for table `dodaci`
--

DROP TABLE IF EXISTS `dodaci`;
CREATE TABLE IF NOT EXISTS `dodaci` (
  `idD` int NOT NULL,
  `naziv` varchar(45) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `cena` int NOT NULL,
  PRIMARY KEY (`idD`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- Dumping data for table `dodaci`
--

INSERT INTO `dodaci` (`idD`, `naziv`, `cena`) VALUES
(1, 'slag', 50),
(2, 'kokosovo mleko', 70),
(3, 'cokolada', 100);

-- --------------------------------------------------------
--
-- 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) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `kafa` int NOT NULL,
  `dodaci` varchar(45) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `iznos` int NOT NULL,
  `status` varchar(45) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`idN`),
  KEY `kupac` (`kupac`),
  KEY `kafa` (`kafa`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

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

INSERT INTO `narudzbine` (`idN`, `kupac`, `kafa`, `dodaci`, `iznos`, `status`) VALUES
(1, 'pera', 2, '1,2', 220, 'U toku'),
(2, 'pera', 3, '1', 250, 'Prihvaceno'),
(3, 'zika', 2, '3', 200, 'U toku');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `narudzbine`
--
ALTER TABLE `narudzbine`
  ADD CONSTRAINT `kafa` FOREIGN KEY (`kafa`) REFERENCES `kafe` (`idK`),
  ADD CONSTRAINT `kupac` FOREIGN KEY (`kupac`) REFERENCES `korisnici` (`kor_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 */;