-- Adminer 4.7.6 MySQL dump

SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';

DROP TABLE IF EXISTS `intro`;
CREATE TABLE `intro` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nazev` varchar(64) COLLATE utf8_czech_ci NOT NULL,
  `autor` varchar(64) COLLATE utf8_czech_ci NOT NULL,
  `rok_vydani` int(5) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;

INSERT INTO `intro` (`id`, `nazev`, `autor`, `rok_vydani`) VALUES
(1,	'Kytice',	'Jaromir Erben',	1901),
(2,	'Karlštejn',	'Nějaky autor',	2022),
(3,	'Steti',	'Neznamy',	2002),
(4,	'Médeia',	'Euripidés',	5),
(5,	'Evžen Oněgin',	'A. S. Puškin',	1823),
(6,	'RUR',	'K. Čapek',	1920),
(7,	'Spalovač mrtvol',	'L. Fuks',	1967),
(8,	'Petr a Lucie',	'R. Rolland',	1920),
(34,	'15knižek',	'15spisovatelu',	1515),
(36,	'Update kniha',	'Update autor',	2022);

DROP TABLE IF EXISTS `vypujceni`;
CREATE TABLE `vypujceni` (
  `id` int(64) NOT NULL AUTO_INCREMENT,
  `id_zakaznici` int(10) NOT NULL,
  `id_intro` int(10) unsigned NOT NULL,
  `datum_vypujceni` datetime NOT NULL,
  `datum_vraceni` datetime NOT NULL,
  `vraceno` bit(1) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `id_zakaznici` (`id_zakaznici`),
  KEY `id_intro` (`id_intro`),
  CONSTRAINT `vypujceni_ibfk_1` FOREIGN KEY (`id_zakaznici`) REFERENCES `zakaznici` (`id`),
  CONSTRAINT `vypujceni_ibfk_2` FOREIGN KEY (`id_intro`) REFERENCES `intro` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;

INSERT INTO `vypujceni` (`id`, `id_zakaznici`, `id_intro`, `datum_vypujceni`, `datum_vraceni`, `vraceno`) VALUES
(1,	2,	3,	'2023-01-12 10:27:56',	'2023-02-01 12:00:00',	CONV('0', 2, 10) + 0),
(2,	2,	4,	'2023-01-12 10:28:39',	'2023-02-01 12:00:00',	CONV('0', 2, 10) + 0),
(3,	2,	7,	'2023-01-12 10:30:19',	'2023-02-01 13:15:30',	CONV('1', 2, 10) + 0),
(4,	4,	8,	'2023-01-12 10:31:10',	'2023-02-01 13:15:30',	CONV('1', 2, 10) + 0),
(5,	4,	4,	'2023-01-12 10:31:23',	'2023-02-01 13:15:30',	CONV('1', 2, 10) + 0),
(6,	5,	6,	'2023-01-12 10:31:53',	'2023-02-01 13:15:30',	CONV('0', 2, 10) + 0);

DROP TABLE IF EXISTS `zakaznici`;
CREATE TABLE `zakaznici` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `username` varchar(64) COLLATE utf8_czech_ci NOT NULL,
  `first_name` varchar(64) COLLATE utf8_czech_ci NOT NULL,
  `last_name` varchar(64) COLLATE utf8_czech_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;

INSERT INTO `zakaznici` (`id`, `username`, `first_name`, `last_name`) VALUES
(1,	'franta',	'Frantíšek',	'Novák'),
(2,	'pepa',	'Josef',	'Tyl'),
(3,	'kubino',	'Jakub',	'Pospíšil'),
(4,	'asvo',	'Alena',	'Svobodová'),
(5,	'olhe',	'Olga ',	'Helclová');

-- 2023-01-13 10:03:13
