A.
Creating Database
The format of writing to make databsae
with manual writing format is:
CREATE DATABASE <namedatabase>
Example: Create DATABASE Penjualan
In order to more quickly be able to directly
access localhost / phpmyadmin and write the name of the database that will be
created and click Create as shown below :
The
next step is to create the necessary tables, as an example we will create a
table of products, transactions, and members
a.
Creating a table with writing manuals
Create Table Produk
create
table Produk(
KodeProduk
char(5) not null constraint PK_Produk primary key ,
NamaProduk
varchar(70) not null,
Harga
numeric(18,2) not null,
Diskon
numeric(18,2) null Default 0)
|
Create Table Transaksi
create
table Transaksi(
NoTran
char(12) not null constraint PK_NoTran primary key,
TglTran
datetime not null,
KodeMember
char(7) not null references Member(KodeMember),
TotalBelanja
numeric(18,2) not null)
|
Create Table Member
create table Member(
KodeMember char(7) not null
constraint PK_Member primary key,
NamaMember varchar(50) not
null,
Alamat varchar(100),
NoTelp varchar(15),
Tipe char(1) not null
constraint Ck_Tipe Check(Tipe In('G','S')))
|
b.
Quickly Create Tables
Once the
product is made then fill in the table fields :
So on the same step for transaction
table and the table member..
No comments:
Post a Comment