Skip to content

cara membuat database penjualan dengan Mysql commandline

May 27, 2011

Ada banyak cara untuk membuat database kalo ini gue membuat database dengan mysql command line

ni contoh darabase penjualan dengan command line bro . .

1. create database penjualan1;
2. use penjualan1;
3. create table barang01 (kode_brg varchar (10),
nama_brg varchar(50) NOT NULL,
QTY int NOT NULL,
Hrg_Satuan int NOT NULL,
PRIMARY KEY (kode_brg));
4. create table pelanggan (kode_pel varchar (10),
nama_pel varchar(75) NOT NULL,
alamat varchar(75) NOT NULL,
kota varchar(30) NOT NULL,
kel_pel varchar(50) NOT NULL,
piutang int NOT NULL,
PRIMARY KEY (kode_pel));
5. insert into barang01 value (‘jr010′,’jeruk’,10,25000);
insert into barang01 value (‘rb020′,’rambutan binjei’,15,30000);
insert into barang01 value (‘ap010′,’apel malang’,10,22000);
6. insert into pelanggan value (‘011001′,’TK berkah’,’ngadiluwih 30′,’kediri’,’toko’,145000);
insert into pelanggan value (‘011002′,’TK makmur jaya’,’pesantren’,’nganjuk’,’toko’,200000);
insert into pelanggan value (‘011003′,’UD sedap malam’,’dhoho 30′,’tulungagung’,’grosir’,1,200000);
7. select from barang01 where nama_brg like ‘a%’;
8. select from barang01 where Hrg_Satuan > 25000;
9. select count (kode_pel) from pelanggan;
10.select sum(piutang) from pelanggan;
11.select sum(piutang) from pelanggan where kel_pel = ‘toko’;

Nie cara ato langkah2nya semoga bermanfaat bro . .

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: