text: -- phpMyAdmin SQL Dump
  -- version 5.0.2
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Dec 22, 2020 at 09:16 AM
  -- Server version: 10.4.14-MariaDB
  -- PHP Version: 7.2.33
  
  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: `perpus`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `admin`
  --
  
  CREATE TABLE `admin` (
    `id_admin` int(5) NOT NULL,
    `nama_admin` varchar(25) NOT NULL,
    `username` varchar(25) NOT NULL,
    `password` varchar(35) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `admin`
  --
  
  INSERT INTO `admin` (`id_admin`, `nama_admin`, `username`, `password`) VALUES
  (1, 'adminGaluh', 'admin', '21232f297a57a5a743894a0e4a801fc3');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `anggota`
  --
  
  CREATE TABLE `anggota` (
    `id_anggota` int(5) NOT NULL,
    `nama_anggota` varchar(45) NOT NULL,
    `gender` enum('Laki-laki','Perempuan') NOT NULL,
    `no_telp` varchar(15) NOT NULL,
    `alamat` varchar(50) NOT NULL,
    `email` varchar(30) NOT NULL,
    `password` varchar(35) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `anggota`
  --
  
  INSERT INTO `anggota` (`id_anggota`, `nama_anggota`, `gender`, `no_telp`, `alamat`, `email`, `password`) VALUES
  (101, 'Galuh', 'Laki-laki', '088809768583', 'Jalan Serdang', 'galuhrianto12@gmail.com', '21232f297a57a5a743894a0e4a801fc3'),
  (102, 'Luh', 'Laki-laki', '0888888888', 'Jalan Kemayoran', 'luhrianto12@gmail.com', '21232f297a57a5a743894a0e4a801fc3'),
  (103, 'Siapa aja', 'Perempuan', '08123456789', 'Jalanan juga V', 'siapaaja@gmail.com', 'admin');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `buku`
  --
  
  CREATE TABLE `buku` (
    `id_buku` int(5) NOT NULL,
    `id_kategori` int(5) NOT NULL,
    `judul_buku` varchar(50) NOT NULL,
    `pengarang` varchar(35) NOT NULL,
    `thn_terbit` date NOT NULL,
    `penerbit` varchar(50) NOT NULL,
    `isbn` varchar(25) NOT NULL,
    `jumlah_buku` int(3) NOT NULL,
    `lokasi` enum('Rak 1','Rak 2','Rak 3') NOT NULL,
    `gambar` varchar(255) NOT NULL,
    `tgl_input` date NOT NULL,
    `status_buku` enum('1','0') NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `buku`
  --
  
  INSERT INTO `buku` (`id_buku`, `id_kategori`, `judul_buku`, `pengarang`, `thn_terbit`, `penerbit`, `isbn`, `jumlah_buku`, `lokasi`, `gambar`, `tgl_input`, `status_buku`) VALUES
  (2, 1, 'Mahir Dengan PHP', 'Adri Kusuma', '2011-02-02', 'Pustaka Bangsa', '6541233', 10, 'Rak 2', 'gambar1607879719.png', '2020-10-18', '1'),
  (3, 2, 'Kamus Bahasa Inggris', 'Retno Puteri', '2012-07-12', 'Bintang Pustaka', '21379821', 6, 'Rak 3', 'gambar1602994576.png', '2020-10-18', '1');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_pinjam`
  --
  
  CREATE TABLE `detail_pinjam` (
    `id_pinjam` int(5) NOT NULL,
    `id_buku` int(5) NOT NULL,
    `tgl_pengembalian` date NOT NULL,
    `denda` double NOT NULL,
    `status_kembali` enum('0','1') NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `kategori`
  --
  
  CREATE TABLE `kategori` (
    `id_kategori` int(5) NOT NULL,
    `nama_kategori` varchar(45) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `kategori`
  --
  
  INSERT INTO `kategori` (`id_kategori`, `nama_kategori`) VALUES
  (1, 'Komputer'),
  (2, 'Bahasa');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `peminjaman`
  --
  
  CREATE TABLE `peminjaman` (
    `id_pinjam` int(11) NOT NULL,
    `tanggal` date NOT NULL,
    `id_anggota` int(5) NOT NULL,
    `tgl_pinjam` date NOT NULL,
    `tgl_kembali` date NOT NULL,
    `totaldenda` double NOT NULL,
    `status_pinjam` enum('0','1') NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `transaksi`
  --
  
  CREATE TABLE `transaksi` (
    `id_pinjam` int(11) NOT NULL,
    `tgl_pencatatan` datetime NOT NULL,
    `id_anggota` int(4) NOT NULL,
    `id_buku` int(4) NOT NULL,
    `tgl_pinjam` date NOT NULL,
    `tgl_kembali` date NOT NULL,
    `denda` double NOT NULL,
    `tgl_pengembalian` date NOT NULL,
    `total_denda` double NOT NULL,
    `status_pengembalian` varchar(15) NOT NULL,
    `status_peminjaman` varchar(25) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `admin`
  --
  ALTER TABLE `admin`
    ADD PRIMARY KEY (`id_admin`);
  
  --
  -- Indexes for table `anggota`
  --
  ALTER TABLE `anggota`
    ADD PRIMARY KEY (`id_anggota`);
  
  --
  -- Indexes for table `buku`
  --
  ALTER TABLE `buku`
    ADD PRIMARY KEY (`id_buku`),
    ADD KEY `fk_buku_kategori` (`id_kategori`);
  
  --
  -- Indexes for table `kategori`
  --
  ALTER TABLE `kategori`
    ADD PRIMARY KEY (`id_kategori`);
  
  --
  -- Indexes for table `transaksi`
  --
  ALTER TABLE `transaksi`
    ADD PRIMARY KEY (`id_pinjam`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `admin`
  --
  ALTER TABLE `admin`
    MODIFY `id_admin` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- AUTO_INCREMENT for table `anggota`
  --
  ALTER TABLE `anggota`
    MODIFY `id_anggota` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=105;
  
  --
  -- AUTO_INCREMENT for table `buku`
  --
  ALTER TABLE `buku`
    MODIFY `id_buku` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
  
  --
  -- AUTO_INCREMENT for table `kategori`
  --
  ALTER TABLE `kategori`
    MODIFY `id_kategori` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- AUTO_INCREMENT for table `transaksi`
  --
  ALTER TABLE `transaksi`
    MODIFY `id_pinjam` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `buku`
  --
  ALTER TABLE `buku`
    ADD CONSTRAINT `fk_buku_kategori` FOREIGN KEY (`id_kategori`) REFERENCES `kategori` (`id_kategori`) ON DELETE CASCADE ON UPDATE CASCADE;
  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 */;
  