text: -- phpMyAdmin SQL Dump
  -- version 4.7.7
  -- https://www.phpmyadmin.net/
  --
  -- Host: localhost:8889
  -- Generation Time: May 15, 2019 at 08:58 PM
  -- Server version: 5.6.38
  -- PHP Version: 7.2.1
  
  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  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: `library_test`
  --
  CREATE DATABASE IF NOT EXISTS `library_test` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
  USE `library_test`;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `authors`
  --
  
  CREATE TABLE `authors` (
    `id` int(11) NOT NULL,
    `first` varchar(255) NOT NULL,
    `last` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  --
  -- Dumping data for table `authors`
  --
  
  INSERT INTO `authors` (`id`, `first`, `last`) VALUES
  (107, 'Steven', 'Brust'),
  (108, 'Emma', 'Bull');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `books`
  --
  
  CREATE TABLE `books` (
    `id` int(11) NOT NULL,
    `title` varchar(255) NOT NULL,
    `year` year(4) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `books_authors`
  --
  
  CREATE TABLE `books_authors` (
    `id` int(11) NOT NULL,
    `book_id` int(11) NOT NULL,
    `author_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `categories`
  --
  
  CREATE TABLE `categories` (
    `id` int(11) NOT NULL,
    `category` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `categories_books`
  --
  
  CREATE TABLE `categories_books` (
    `id` int(11) NOT NULL,
    `category_id` int(11) NOT NULL,
    `book_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `checkouts`
  --
  
  CREATE TABLE `checkouts` (
    `id` int(11) NOT NULL,
    `copies_id` int(11) NOT NULL,
    `patron_id` int(11) NOT NULL,
    `due_date` date NOT NULL,
    `checkout_date` date NOT NULL,
    `returned_date` date DEFAULT NULL,
    `returned` tinyint(1) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `copies`
  --
  
  CREATE TABLE `copies` (
    `id` int(11) NOT NULL,
    `book_id` int(11) NOT NULL,
    `stock` int(11) NOT NULL,
    `available` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `patrons`
  --
  
  CREATE TABLE `patrons` (
    `id` int(11) NOT NULL,
    `first` varchar(255) NOT NULL,
    `last` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `authors`
  --
  ALTER TABLE `authors`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `books`
  --
  ALTER TABLE `books`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `books_authors`
  --
  ALTER TABLE `books_authors`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `categories`
  --
  ALTER TABLE `categories`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `categories_books`
  --
  ALTER TABLE `categories_books`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `checkouts`
  --
  ALTER TABLE `checkouts`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `copies`
  --
  ALTER TABLE `copies`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `patrons`
  --
  ALTER TABLE `patrons`
    ADD PRIMARY KEY (`id`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `authors`
  --
  ALTER TABLE `authors`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=109;
  
  --
  -- AUTO_INCREMENT for table `books`
  --
  ALTER TABLE `books`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=160;
  
  --
  -- AUTO_INCREMENT for table `books_authors`
  --
  ALTER TABLE `books_authors`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
  
  --
  -- AUTO_INCREMENT for table `categories`
  --
  ALTER TABLE `categories`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `categories_books`
  --
  ALTER TABLE `categories_books`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `checkouts`
  --
  ALTER TABLE `checkouts`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `copies`
  --
  ALTER TABLE `copies`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;
  
  --
  -- AUTO_INCREMENT for table `patrons`
  --
  ALTER TABLE `patrons`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  /*!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 */;
  