This document outlines the database design for a minimarket management system. It defines several tables including tables for items, suppliers, sales, employees, and transactions. It provides the field names and data types for each table. It also includes sample data and SQL commands to create the database schema and populate the tables.
This document outlines the database design for a minimarket management system. It defines several tables including tables for items, suppliers, sales, employees, and transactions. It provides the field names and data types for each table. It also includes sample data and SQL commands to create the database schema and populate the tables.
This document outlines the database design for a minimarket management system. It defines several tables including tables for items, suppliers, sales, employees, and transactions. It provides the field names and data types for each table. It also includes sample data and SQL commands to create the database schema and populate the tables.
FAKULTAS TEKNIK UNIVERSITAS MUHAMMADIYAH MATARAM 2020/2021 Data Tabel : Nama Tabel : jenis Primary Key: kode_jenis Foreign Key :- NO NAMA FIELD TYPE DATA PANJANG 1 KODEJENIS CHAR 4 2 JENIS VARCHAR 60
Primary Key: tgl_masuk Foreign Key : - NO NAMA FIELD TYPE DATA PANJANG 1 NONOTA* CHAR 10 2 TGLMASUK VARCHAR 30 3 IDDISTRIBUTOR CHAR 6 4 IDPETUGAS CHAR 6 Nama Tabel : Nofaktur* Primary Key: tgl_penjualan Foreign Key : - NO NAMA FIELD TYPE DATA PANJANG 1 NOFAKTUR CHAR 10 2 TGLPENJUALAN VARCHAR 30 3 IDPETUGAS CHAR 6 4 BAYAR DOUBLE - 5 SISA DOUBLE - 6 TOTAL DOUBLE -
Contoh data tabel relasasi :
Database Perintah SQL : create database if not exists `minimarket`; USE `minimarket`; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*Table structure for table `barang` */ DROP TABLE IF EXISTS `barang`;
CREATE TABLE `barang` (
`id_barang` varchar(20) NOT NULL, `nama_barang` varchar(50) NOT NULL, `stok` int(11) NOT NULL, `harga_pokok` double(10,2) NOT NULL, `harga_jual` double(10,2) NOT NULL, `ppn` int(11) NOT NULL, `diskon` int(11) NOT NULL, PRIMARY KEY (`id_barang`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*Data for the table `barang` */ insert into barang`(`id_barang`,`nama_barang`,`stok`,`harga_pokok`,`harga_jual`,`ppn`,`diskon`) values('121','Kenko',240,400.00,700.00,5,0),('1234',Sinar Dunia',200,1200.00,1450.00,10,0),('212','Pilot',200,1200.00,1350.00,10,0); /*Table structure for table `distributor` */ DROP TABLE IF EXISTS `distributor`;
CREATE TABLE `distributor` (
`id_distributor` int(11) NOT NULL AUTO_INCREMENT, `nama_distributor` varchar(100) NOT NULL, `alamat` varchar(150) NOT NULL, `telepon` varchar(14) NOT NULL, PRIMARY KEY (`id_distributor`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*Data for the table `distributor` */
Insert into `distributor`(`id_distributor`,`nama_distributor`,`alamat`,`telepon`) values
(1,'CV>SAYANGHEULANG','Ds.Cijantra Kec.Pagedangan Tangerang- Banten','02191967637'); /*Table structure for table `kasir` */ DROP TABLE IF EXISTS `kasir`;
CREATE TABLE `kasir` (
`id_kasir` int(11) NOT NULL AUTO_INCREMENT, `nama` varchar(50) NOT NULL, `alamat` varchar(150) NOT NULL, `telepon` varchar(14) NOT NULL, `status` varchar(12) NOT NULL, `username` varchar(30) NOT NULL, `password` varchar(30) NOT NULL, `akses` varchar(6) NOT NULL, PRIMARY KEY (`id_kasir`) ) ENGINE=InnoDB AUTO_INCREMENT=113 DEFAULT CHARSET=latin1; /*Data for the table `kasir` */ insert into `kasir`(`id_kasir`,`nama`,`alamat`,`telepon`,`status`,`username`,`password`,`akses`) values (112,'Dedi Rahmadi','Legok _Tangerang','08567572172','Aktif','dedi','qiana','Admin'); /*Table structure for table `pasok` */ DROP TABLE IF EXISTS `pasok`;
CREATE TABLE `pasok` (
`id_pasok` int(11) NOT NULL AUTO_INCREMENT, `id_distributor` int(11) NOT NULL, `id_barang` varchar(20) NOT NULL, `jumlah` int(11) NOT NULL, `tanggal` date NOT NULL, PRIMARY KEY (`id_pasok`), KEY `id_distributor` (`id_distributor`,`id_barang`), KEY `id_barang` (`id_barang`), CONSTRAINT `pasok_ibfk_1` FOREIGN KEY (`id_distributor`) REFERENCES `distributor` (`id_distributor`), CONSTRAINT `pasok_ibfk_2` FOREIGN KEY (`id_barang`) REFERENCES `barang` (`id_barang`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*Data for the table `pasok` */ /*Table structure for table `penjualan` */ DROP TABLE IF EXISTS `penjualan`;
CREATE TABLE `penjualan` (
`id_penjualan` int(11) NOT NULL AUTO_INCREMENT, `id_barang` varchar(20) NOT NULL, `id_kasir` int(11) NOT NULL, `jumlah` int(11) NOT NULL, `total` double(10,2) NOT NULL, `tanggal` date NOT NULL, PRIMARY KEY (`id_penjualan`), KEY `id_barang` (`id_barang`), KEY `id_kasir` (`id_kasir`), CONSTRAINT `penjualan_ibfk_2` FOREIGN KEY (`id_kasir`) REFERENCES `kasir` (`id_kasir`), CONSTRAINT `penjualan_ibfk_3` FOREIGN KEY (`id_barang`) REFERENCES `barang` (`id_barang`) ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1; /*Data for the table `penjualan` */
insert into `penjualan`(`id_penjualan`,`id_barang`,`id_kasir`,`jumlah`,`total`,`tanggal`)