text: -- phpMyAdmin SQL Dump
  -- version 4.7.0
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Feb 05, 2019 at 03:14 PM
  -- Server version: 10.1.25-MariaDB
  -- PHP Version: 5.6.31
  
  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: `toko_baju`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `buku`
  --
  
  CREATE TABLE `buku` (
    `kode_buku` int(11) NOT NULL,
    `judul_buku` varchar(50) DEFAULT NULL,
    `tahun` int(11) DEFAULT NULL,
    `kode_kategori` int(11) DEFAULT NULL,
    `harga` int(11) DEFAULT NULL,
    `cover` varchar(100) DEFAULT NULL,
    `penerbit` varchar(100) DEFAULT NULL,
    `penulis` varchar(100) DEFAULT NULL,
    `stok` int(11) DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `buku`
  --
  
  INSERT INTO `buku` (`kode_buku`, `judul_buku`, `tahun`, `kode_kategori`, `harga`, `cover`, `penerbit`, `penulis`, `stok`) VALUES
  (46, 'Long Dress', NULL, 19, 100000, NULL, NULL, NULL, 4),
  (47, 'Kemeja', NULL, 20, 60000, NULL, NULL, NULL, 3),
  (48, 'Kacamata', NULL, 21, 25000, NULL, NULL, NULL, 1);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_transaksi`
  --
  
  CREATE TABLE `detail_transaksi` (
    `kode_detail_transaksi` int(11) NOT NULL,
    `kode_transaksi` int(11) NOT NULL,
    `kode_buku` int(11) NOT NULL,
    `jumlah` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `detail_transaksi`
  --
  
  INSERT INTO `detail_transaksi` (`kode_detail_transaksi`, `kode_transaksi`, `kode_buku`, `jumlah`) VALUES
  (10, 47, 46, 1);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `kategori`
  --
  
  CREATE TABLE `kategori` (
    `kode_kategori` int(11) NOT NULL,
    `nama_kategori` varchar(100) DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `kategori`
  --
  
  INSERT INTO `kategori` (`kode_kategori`, `nama_kategori`) VALUES
  (19, 'Pakaian Perempuan'),
  (20, 'Pakaian Laki-laki'),
  (21, 'Aksesoris');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `transaksi`
  --
  
  CREATE TABLE `transaksi` (
    `kode_transaksi` int(11) NOT NULL,
    `kode_user` int(11) DEFAULT NULL,
    `nama_pembeli` varchar(50) DEFAULT NULL,
    `total` int(11) DEFAULT NULL,
    `tanggal_beli` date DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `transaksi`
  --
  
  INSERT INTO `transaksi` (`kode_transaksi`, `kode_user`, `nama_pembeli`, `total`, `tanggal_beli`) VALUES
  (47, 4, 'Dimas', 100000, '2019-02-05');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `user`
  --
  
  CREATE TABLE `user` (
    `kode_user` int(11) NOT NULL,
    `nama_user` varchar(100) DEFAULT NULL,
    `username` varchar(100) DEFAULT NULL,
    `password` varchar(100) DEFAULT NULL,
    `level` varchar(100) DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `user`
  --
  
  INSERT INTO `user` (`kode_user`, `nama_user`, `username`, `password`, `level`) VALUES
  (1, 'boss', 'admin1', 'admin1', 'admin'),
  (4, 'Rizal', 'kasir1', 'kasir1', 'kasir'),
  (5, 'Agus', 'kasir2', 'kasir2', 'kasir');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `buku`
  --
  ALTER TABLE `buku`
    ADD PRIMARY KEY (`kode_buku`),
    ADD KEY `kode_kategori` (`kode_kategori`);
  
  --
  -- Indexes for table `detail_transaksi`
  --
  ALTER TABLE `detail_transaksi`
    ADD PRIMARY KEY (`kode_detail_transaksi`),
    ADD KEY `kode_transaksi` (`kode_transaksi`),
    ADD KEY `kode_buku` (`kode_buku`);
  
  --
  -- Indexes for table `kategori`
  --
  ALTER TABLE `kategori`
    ADD PRIMARY KEY (`kode_kategori`);
  
  --
  -- Indexes for table `transaksi`
  --
  ALTER TABLE `transaksi`
    ADD PRIMARY KEY (`kode_transaksi`),
    ADD KEY `kode_user` (`kode_user`);
  
  --
  -- Indexes for table `user`
  --
  ALTER TABLE `user`
    ADD PRIMARY KEY (`kode_user`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `buku`
  --
  ALTER TABLE `buku`
    MODIFY `kode_buku` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=49;
  --
  -- AUTO_INCREMENT for table `detail_transaksi`
  --
  ALTER TABLE `detail_transaksi`
    MODIFY `kode_detail_transaksi` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
  --
  -- AUTO_INCREMENT for table `kategori`
  --
  ALTER TABLE `kategori`
    MODIFY `kode_kategori` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
  --
  -- AUTO_INCREMENT for table `transaksi`
  --
  ALTER TABLE `transaksi`
    MODIFY `kode_transaksi` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=48;
  --
  -- AUTO_INCREMENT for table `user`
  --
  ALTER TABLE `user`
    MODIFY `kode_user` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `buku`
  --
  ALTER TABLE `buku`
    ADD CONSTRAINT `buku_ibfk_1` FOREIGN KEY (`kode_kategori`) REFERENCES `kategori` (`kode_kategori`) ON DELETE CASCADE ON UPDATE NO ACTION;
  
  --
  -- Constraints for table `detail_transaksi`
  --
  ALTER TABLE `detail_transaksi`
    ADD CONSTRAINT `detail_transaksi_ibfk_1` FOREIGN KEY (`kode_transaksi`) REFERENCES `transaksi` (`kode_transaksi`) ON DELETE CASCADE ON UPDATE NO ACTION,
    ADD CONSTRAINT `detail_transaksi_ibfk_2` FOREIGN KEY (`kode_buku`) REFERENCES `buku` (`kode_buku`) ON DELETE CASCADE ON UPDATE NO ACTION;
  
  --
  -- Constraints for table `transaksi`
  --
  ALTER TABLE `transaksi`
    ADD CONSTRAINT `transaksi_ibfk_1` FOREIGN KEY (`kode_user`) REFERENCES `user` (`kode_user`) ON DELETE CASCADE ON UPDATE NO ACTION;
  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 */;
  