text: -- phpMyAdmin SQL Dump
  -- version 4.2.11
  -- http://www.phpmyadmin.net
  --
  -- Host: 127.0.0.1
  -- Generation Time: 28 Jan 2019 pada 06.52
  -- Versi Server: 5.6.21
  -- PHP Version: 5.6.3
  
  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 utf8 */;
  
  --
  -- Database: `onlineshop`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Struktur dari tabel `admin`
  --
  
  CREATE TABLE IF NOT EXISTS `admin` (
  `id_admin` int(11) NOT NULL,
    `username` varchar(50) NOT NULL,
    `password` varchar(50) NOT NULL
  ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data untuk tabel `admin`
  --
  
  INSERT INTO `admin` (`id_admin`, `username`, `password`) VALUES
  (2, 'admin1', 'admin1'),
  (3, 'devano', 'devano'),
  (4, 'admin', 'admin');
  
  -- --------------------------------------------------------
  
  --
  -- Struktur dari tabel `barang`
  --
  
  CREATE TABLE IF NOT EXISTS `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 AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data untuk tabel `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),
  (5, 'Laptop', '10000', 10, 1),
  (6, 'Bluestack', '800000', 12, 1);
  
  -- --------------------------------------------------------
  
  --
  -- Struktur dari tabel `kategori`
  --
  
  CREATE TABLE IF NOT EXISTS `kategori` (
  `id_kategori` int(11) NOT NULL,
    `nama_kategori` varchar(50) NOT NULL
  ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data untuk tabel `kategori`
  --
  
  INSERT INTO `kategori` (`id_kategori`, `nama_kategori`) VALUES
  (1, 'Laptop'),
  (2, 'Accesories'),
  (3, 'Smarth Phone'),
  (4, 'Software'),
  (6, 'Televisi'),
  (7, 'Komputer'),
  (8, 'barang');
  
  -- --------------------------------------------------------
  
  --
  -- Struktur dari tabel `nota`
  --
  
  CREATE TABLE IF NOT EXISTS `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;
  
  -- --------------------------------------------------------
  
  --
  -- Struktur dari tabel `pembeli`
  --
  
  CREATE TABLE IF NOT EXISTS `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 AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data untuk tabel `pembeli`
  --
  
  INSERT INTO `pembeli` (`id_pembeli`, `nama_pembeli`, `alamat`, `no_telp`, `username`, `password`) VALUES
  (1, 'devano', 'Danau Ranau Gg 12', '081934455', 'devano', 'devano123');
  
  -- --------------------------------------------------------
  
  --
  -- Struktur dari tabel `transaksi`
  --
  
  CREATE TABLE IF NOT EXISTS `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=5;
  --
  -- 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=2;
  --
  -- AUTO_INCREMENT for table `transaksi`
  --
  ALTER TABLE `transaksi`
  MODIFY `id_trans` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables)
  --
  
  --
  -- Ketidakleluasaan untuk tabel `barang`
  --
  ALTER TABLE `barang`
  ADD CONSTRAINT `barang_ibfk_1` FOREIGN KEY (`id_kategori`) REFERENCES `kategori` (`id_kategori`);
  
  --
  -- Ketidakleluasaan untuk tabel `nota`
  --
  ALTER TABLE `nota`
  ADD CONSTRAINT `nota_ibfk_1` FOREIGN KEY (`id_pembeli`) REFERENCES `pembeli` (`id_pembeli`);
  
  --
  -- Ketidakleluasaan untuk tabel `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`);
  
  /*!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 */;
  