-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 16, 2018 at 09:21 PM
-- Server version: 10.1.30-MariaDB
-- PHP Version: 7.2.2

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
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: `projekt`
--

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

--
-- Table structure for table `autorzy`
--

CREATE TABLE `autorzy` (
  `IDAutor` int(11) NOT NULL,
  `imie` text COLLATE utf8_polish_ci NOT NULL,
  `nazwisko` text COLLATE utf8_polish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;

--
-- Dumping data for table `autorzy`
--

INSERT INTO `autorzy` (`IDAutor`, `imie`, `nazwisko`) VALUES
(1, 'Juliusz', 'Verne'),
(2, 'Adam', 'Mickiewicz'),
(3, 'Adam', 'Asnyk');

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

--
-- Table structure for table `egzemplarze`
--

CREATE TABLE `egzemplarze` (
  `IDEgzemplarz` int(11) NOT NULL,
  `IDKsiazka` int(11) NOT NULL,
  `DoWypozyczenia` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;

--
-- Dumping data for table `egzemplarze`
--

INSERT INTO `egzemplarze` (`IDEgzemplarz`, `IDKsiazka`, `DoWypozyczenia`) VALUES
(1, 1, 0),
(2, 1, 1),
(3, 3, 0),
(4, 3, 1),
(5, 4, 0),
(6, 4, 1);

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

--
-- Table structure for table `ksiazki`
--

CREATE TABLE `ksiazki` (
  `IDKsiazka` int(11) NOT NULL,
  `IDAutor` int(11) NOT NULL,
  `tytul` text COLLATE utf8_polish_ci NOT NULL,
  `wydawnictwo` text COLLATE utf8_polish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;

--
-- Dumping data for table `ksiazki`
--

INSERT INTO `ksiazki` (`IDKsiazka`, `IDAutor`, `tytul`, `wydawnictwo`) VALUES
(1, 1, 'W 80 dni dookoła świata', 'Iskry'),
(2, 2, 'Dziady', 'Nasza Księgarnia'),
(3, 1, 'Pięć tygodni w balonie', 'Ossolineum'),
(4, 1, 'Napowietrzna wioska', 'Zielona Sowa');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `autorzy`
--
ALTER TABLE `autorzy`
  ADD PRIMARY KEY (`IDAutor`);

--
-- Indexes for table `egzemplarze`
--
ALTER TABLE `egzemplarze`
  ADD PRIMARY KEY (`IDEgzemplarz`),
  ADD KEY `KsiazkaID` (`IDKsiazka`);

--
-- Indexes for table `ksiazki`
--
ALTER TABLE `ksiazki`
  ADD PRIMARY KEY (`IDKsiazka`),
  ADD KEY `IDAutor` (`IDAutor`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `autorzy`
--
ALTER TABLE `autorzy`
  MODIFY `IDAutor` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `egzemplarze`
--
ALTER TABLE `egzemplarze`
  MODIFY `IDEgzemplarz` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `ksiazki`
--
ALTER TABLE `ksiazki`
  MODIFY `IDKsiazka` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `egzemplarze`
--
ALTER TABLE `egzemplarze`
  ADD CONSTRAINT `egzemplarze_ibfk_1` FOREIGN KEY (`IDKsiazka`) REFERENCES `ksiazki` (`IDKsiazka`);

--
-- Constraints for table `ksiazki`
--
ALTER TABLE `ksiazki`
  ADD CONSTRAINT `ksiazki_ibfk_1` FOREIGN KEY (`IDAutor`) REFERENCES `autorzy` (`IDAutor`);
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 */;
