CREATE DATABASE  IF NOT EXISTS `perionica2024` /*!40100 DEFAULT CHARACTER SET utf8mb3 */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `perionica2024`;


CREATE TABLE `korisnici` (
  `kor_ime` varchar(45) NOT NULL,
  `lozinka` varchar(45) DEFAULT NULL,
  `tip` varchar(45) DEFAULT NULL,
  `ime` varchar(45) DEFAULT NULL,
  `prezime` varchar(45) DEFAULT NULL,
  `mejl` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`kor_ime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;



INSERT INTO `korisnici` VALUES ('ana','ana123','klijent','Ana','Anic','ana@gmail.com'),('jova','jova123','klijent','Jova','Jovic','jova@gmail.com'),('maja','maja123','radnik','Maja','Majic','maja@gmail.com');


CREATE TABLE `stvariklijenta` (
  `idS` int NOT NULL AUTO_INCREMENT,
  `naziv` varchar(45) DEFAULT NULL,
  `klijent` varchar(45) DEFAULT NULL,
  `napomena` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`idS`),
  KEY `klijent_idx` (`klijent`),
  CONSTRAINT `klijent` FOREIGN KEY (`klijent`) REFERENCES `korisnici` (`kor_ime`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3;


INSERT INTO `stvariklijenta` VALUES (1,'majica na pruge','ana',NULL),(2,'jakna','ana','fleka od vina'),(3,'majica sa snupijem','ana','fleka od kafe'),(4,'kosulja','jova',NULL),(5,'jakna','jova',NULL),(6,'haljina','ana',NULL);

CREATE TABLE `zahtevi` (
  `idZ` int NOT NULL AUTO_INCREMENT,
  `klijent` varchar(45) DEFAULT NULL,
  `stvari` varchar(45) DEFAULT NULL,
  `status` varchar(45) DEFAULT NULL,
  `datum` date DEFAULT NULL,
  PRIMARY KEY (`idZ`),
  KEY `klijent_idx` (`klijent`),
  CONSTRAINT `kor` FOREIGN KEY (`klijent`) REFERENCES `korisnici` (`kor_ime`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3;


INSERT INTO `zahtevi` VALUES (1,'ana','1,2','neobradjen',NULL),(2,'jova','4','u obradi','2024-06-14'),(3,'ana','3','gotovo','2024-06-10');
