text: -- phpMyAdmin SQL Dump
  -- version 4.7.7
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Jan 28, 2019 at 07:01 AM
  -- 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: `onlineshop`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `admin`
  --
  
  CREATE TABLE `admin` (
    `id_admin` int(11) NOT NULL,
    `username` varchar(50) NOT NULL,
    `password` varchar(50) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `admin`
  --
  
  INSERT INTO `admin` (`id_admin`, `username`, `password`) VALUES
  (2, 'admin1', 'admin1');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `barang`
  --
  
  CREATE TABLE `barang` (
    `id_barang` int(11) NOT NULL,
    `nama_barang` varchar(50) NOT NULL,
    `harga` varchar(50) NOT NULL,
    `stok` int(11) NOT NULL,
    `id_kategori` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `barang`
  --
  
  INSERT INTO `barang` (`id_barang`, `nama_barang`, `harga`, `stok`, `id_kategori`) VALUES
  (1, 'Laptop Asus', '7000000', 3, 1),
  (2, 'Headset', '200000', 4, 2),
  (3, 'Hp Samsung', '5000000', 5, 3),
  (4, 'Adobe Photoshop', '100000', 7, 4),
  (6, ']Xiaomi Black Shark', '7000000', 15, 3);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `kategori`
  --
  
  CREATE TABLE `kategori` (
    `id_kategori` int(11) NOT NULL,
    `nama_kategori` varchar(50) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `kategori`
  --
  
  INSERT INTO `kategori` (`id_kategori`, `nama_kategori`) VALUES
  (1, 'Laptop'),
  (2, 'Accesories'),
  (3, 'Smarth Phone'),
  (4, 'Software'),
  (6, 'Televisi'),
  (7, 'Komputer'),
  (8, 'headset');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `nota`
  --
  
  CREATE TABLE `nota` (
    `id_nota` int(11) NOT NULL,
    `id_pembeli` int(11) NOT NULL,
    `grandtotal` int(11) NOT NULL,
    `tgl` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `pembeli`
  --
  
  CREATE TABLE `pembeli` (
    `id_pembeli` int(11) NOT NULL,
    `nama_pembeli` varchar(50) NOT NULL,
    `alamat` text NOT NULL,
    `no_telp` varchar(50) NOT NULL,
    `username` varchar(50) NOT NULL,
    `password` varchar(50) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `pembeli`
  --
  
  INSERT INTO `pembeli` (`id_pembeli`, `nama_pembeli`, `alamat`, `no_telp`, `username`, `password`) VALUES
  (1, 'Budi', 'Jalan Danau Ranau 9', '08123456789', 'budii', 'qwerty'),
  (2, 'Anas', 'Jalan Danau Posoos', '0876543666', 'Anass', '12343333'),
  (4, 'Agus', 'Jalan Danau Buyan', '081188883333', 'Agusantoso', 'abcffff'),
  (5, 'Ravenclaw', 'JL Danau Pso', '0822121212121', 'ChewyGum', 'qwerty'),
  (6, 'aksd', 'aksudhaf', '12317', 'oasjd1', 'kausdhakus1');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `transaksi`
  --
  
  CREATE TABLE `transaksi` (
    `id_trans` int(11) NOT NULL,
    `id_nota` int(11) NOT NULL,
    `id_barang` int(11) NOT NULL,
    `qty` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `admin`
  --
  ALTER TABLE `admin`
    ADD PRIMARY KEY (`id_admin`);
  
  --
  -- Indexes for table `barang`
  --
  ALTER TABLE `barang`
    ADD PRIMARY KEY (`id_barang`),
    ADD KEY `id_kategori` (`id_kategori`) USING BTREE;
  
  --
  -- Indexes for table `kategori`
  --
  ALTER TABLE `kategori`
    ADD PRIMARY KEY (`id_kategori`);
  
  --
  -- Indexes for table `nota`
  --
  ALTER TABLE `nota`
    ADD PRIMARY KEY (`id_nota`),
    ADD KEY `id_pembeli` (`id_pembeli`);
  
  --
  -- Indexes for table `pembeli`
  --
  ALTER TABLE `pembeli`
    ADD PRIMARY KEY (`id_pembeli`);
  
  --
  -- Indexes for table `transaksi`
  --
  ALTER TABLE `transaksi`
    ADD PRIMARY KEY (`id_trans`),
    ADD KEY `id_nota` (`id_nota`),
    ADD KEY `id_barang` (`id_barang`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `admin`
  --
  ALTER TABLE `admin`
    MODIFY `id_admin` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- AUTO_INCREMENT for table `barang`
  --
  ALTER TABLE `barang`
    MODIFY `id_barang` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
  
  --
  -- AUTO_INCREMENT for table `kategori`
  --
  ALTER TABLE `kategori`
    MODIFY `id_kategori` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
  
  --
  -- AUTO_INCREMENT for table `nota`
  --
  ALTER TABLE `nota`
    MODIFY `id_nota` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `pembeli`
  --
  ALTER TABLE `pembeli`
    MODIFY `id_pembeli` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
  
  --
  -- AUTO_INCREMENT for table `transaksi`
  --
  ALTER TABLE `transaksi`
    MODIFY `id_trans` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `barang`
  --
  ALTER TABLE `barang`
    ADD CONSTRAINT `barang_ibfk_1` FOREIGN KEY (`id_kategori`) REFERENCES `kategori` (`id_kategori`);
  
  --
  -- Constraints for table `nota`
  --
  ALTER TABLE `nota`
    ADD CONSTRAINT `nota_ibfk_1` FOREIGN KEY (`id_pembeli`) REFERENCES `pembeli` (`id_pembeli`);
  
  --
  -- Constraints for table `transaksi`
  --
  ALTER TABLE `transaksi`
    ADD CONSTRAINT `transaksi_ibfk_1` FOREIGN KEY (`id_barang`) REFERENCES `barang` (`id_barang`),
    ADD CONSTRAINT `transaksi_ibfk_2` FOREIGN KEY (`id_nota`) REFERENCES `nota` (`id_nota`);
  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 */;
  