01
Jun
09

MEMBUAT TABEL DENGAN SQL SERVER 2000

er-diagram

–BUAT DATABASE BARU DENGAN NAMA TUGAS

create database tugas

–MENGGUNAKAN DATABASE

use tugas

–MEMBUAT TABEL BARANG

create table barang

(

kode_barang CHAR(4) not null primary key,

nama_barang VARCHAR(20) not null,

harga_barang@ MONEY not null,

jumlah_stok INTEGER not null,

)

–MEMBUAT TABLE TRANSAKSI

create table transaksi

(

kode_transaksi CHAR(4) not null primary key,

kode_barang CHAR(4) not null references barang(kode_barang)

on delete no action on update cascade,

harga_barang@ MONEY not null,

jumlah_pembelian INTEGER not null

)

–MENAMPILKAN SEMUA TABEL DI DATABASE TUGAS

select * from information_schema.tables

–MENAMPILKAN SEMUA RECORD BARANG

select * from barang

–MENAMPILKAN SEMUA RECORD PADA TABEL TRANSAKSI

select * from transaksi

–MENGISI TABEL BARANG

insert into barang values (‘0001′,’pepsodente’,5000,100)

insert into barang values (‘0002′,’saboon’,2000,254)

insert into barang values (‘0003′,’sikat’,2500,150)

insert into barang values (‘0004′,’odol’,2000,100)

insert into barang values (‘0005′,’perment’,500,45)

–MENGISI TABEL TRANSAKSI

insert into transaksi values (‘0050′,’0001’,5000,10)

insert into transaksi values (‘0051′,’0002’,2000,5)

insert into transaksi values (‘0052′,’0002’,2000,6)

insert into transaksi values (‘0053′,’0003’,2500,6)

insert into transaksi values (‘0054′,’0001’,5000,10)

insert into transaksi values (‘0055′,’0004’,2000,8)

insert into transaksi values (‘0056′,’0005’,500,5)

insert into transaksi values (‘0057′,’0003’,2500,4)

insert into transaksi values (‘0058′,’0005’,500,1)

–MELIHAT ISI TABLE

select * from barang

select * from transaksi

scr


5 Responses to “MEMBUAT TABEL DENGAN SQL SERVER 2000”


  1. 1 Jerly
    February 17, 2010 at 1:57 am

    Thx y…. sangt membntu……

  2. March 11, 2010 at 8:40 am

    thanks Y, nice posting

  3. June 13, 2010 at 2:05 am

    tolong donk cara,Y yang komplit……?? maksih

  4. August 6, 2010 at 4:46 am

    mas saya mau tanya fungsi enum dalam syntax tabel apa ya…
    kalaw contohnya gimana ya mas


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


Blog Stats

  • 168,765 hits

MY PERSONAL LINK

June 2009
M T W T F S S
« Apr   Feb »
1234567
891011121314
15161718192021
22232425262728
2930  

%d bloggers like this: