Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-mart-koperasi-itdel
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kelompok-5-dwbi
data-mart-koperasi-itdel
Commits
91fec4f8
Commit
91fec4f8
authored
May 29, 2020
by
evi fanny dear
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
b47b8b07
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
243 additions
and
0 deletions
+243
-0
KoperasiXYZ_db.sql
Database Proyek/KoperasiXYZ_db.sql
+243
-0
No files found.
Database Proyek/KoperasiXYZ_db.sql
0 → 100644
View file @
91fec4f8
CREATE
TABLE
Dim_Barang
(
[
ID_Barang
]
[
int
]
not
null
,
[
Nama_Barang
]
[
varchar
]
not
null
,
[
Kategori_Barang
]
[
varchar
]
not
null
,
[
Brand
]
[
varchar
]
not
null
,
[
Harga_Jual_Barang
]
[
money
]
not
null
,
[
Harga_Beli_Barang
]
[
money
]
not
null
,
[
Waktu_Kadaluarsa
]
[
timestamp
]
not
null
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Barang
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
GO
CREATE
TABLE
Dim_Kategori
(
[
ID_Kategori
]
[
int
]
not
null
,
[
Kategori
]
[
varchar
]
not
null
,
[
Satuan_Barang
]
[
varchar
]
not
null
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Kategori
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
GO
CREATE
TABLE
Dim_Satuan
(
[
ID_Satuan
]
[
int
]
not
null
,
[
Nama_Satuan
]
[
varchar
]
not
null
,
[
Harga_Jual_Persatuan
]
[
money
]
not
null
,
[
Harga_Beli_Persatuan
]
[
money
]
not
null
,
[
Waktu_Kadaluarsa
]
[
timestamp
]
not
null
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Satuan
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
GO
CREATE
TABLE
Dim_Pembayaran
(
[
ID_Pembayaran
]
[
int
]
not
null
,
[
Metode_Pembayaran
]
[
varchar
]
not
null
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Pembayaran
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
GO
CREATE
TABLE
Dim_Pelanggan
(
[
ID_Pelanggan
]
[
int
]
not
null
,
[
Nama_Pelanggan
]
[
varchar
]
not
null
,
[
Alamat_Pelanggan
]
[
varchar
]
not
null
,
[
No_Telp_Pelanggan
]
[
int
]
not
null
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Pelanggan
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
GO
CREATE
TABLE
Dim_Supplier
(
[
ID_Supplier
]
[
int
]
not
null
,
[
Nama_Supplier
]
[
varchar
]
not
null
,
[
Alamat_Supplier
]
[
varchar
]
not
null
,
[
No_Telp_Supplier
]
[
int
]
not
null
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Supplier
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
GO
CREATE
TABLE
Dim_Gudang
(
[
ID_Gudang
]
[
int
]
not
null
,
[
Nama_Gudang
]
[
varchar
]
not
null
,
[
Alamat_Gudang
]
[
varchar
]
not
null
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Gudang
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
GO
CREATE
TABLE
Dim_Waktu
(
[
ID_Waktu
]
[
int
]
not
null
,
[
Tahun
]
[
timestamp
]
not
null
,
[
Bulan
]
[
int
]
not
null
,
[
Tanggal
]
[
date
]
not
null
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Waktu
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
GO
CREATE
TABLE
Dim_Tahun
(
[
ID_Tahun
]
[
int
]
not
null
,
[
Tahun
]
[
timestamp
]
not
null
,
[
Bulan
]
[
int
]
not
null
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Tahun
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
GO
CREATE
TABLE
Dim_Bulan
(
[
ID_Bulan
]
[
int
]
not
null
,
[
Bulan
]
[
int
]
not
null
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Bulan
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
GO
CREATE
TABLE
[
dbo
].[
Fact_Penjualan
](
[
ID_Waktu
]
[
int
]
NOT
NULL
,
[
ID_Barang
]
[
int
]
NOT
NULL
,
[
ID_Pelanggan
]
[
int
]
NOT
NULL
,
[
ID_Pembayaran
]
[
int
]
NOT
NULL
,
[
Harga_Satuan
]
[
money
]
NULL
,
[
PPN_Persen
]
[
decimal
]
NULL
,
[
PPN_Rupiah
]
[
decimal
]
NULL
,
[
Jlh_Barang_Jual
]
[
int
]
NULL
,
[
Jlh_Barang_Bayar
]
[
int
]
NULL
,
[
Jlh_Barang_Sebelum_Pajak
]
[
int
]
NULL
,
[
Jlh_Barang_Setelah_Pajak
]
[
int
]
NULL
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Waktu
]
ASC
,
[
ID_Barang
]
ASC
,
[
ID_Pembayaran
]
ASC
,
[
ID_Pelanggan
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
ON
[
PRIMARY
]
GO
ALTER
TABLE
[
dbo
].[
Fact_Penjualan
]
WITH
CHECK
ADD
CONSTRAINT
[
FK_Dim_Barang_ID_Barang
]
FOREIGN
KEY
([
ID_Barang
])
REFERENCES
[
dbo
].[
Dim_Barang
]
([
ID_Barang
])
GO
ALTER
TABLE
[
dbo
].[
Fact_Penjualan
]
CHECK
CONSTRAINT
[
FK_Dim_Barang_ID_Barang
]
GO
ALTER
TABLE
[
dbo
].[
Fact_Penjualan
]
WITH
CHECK
ADD
CONSTRAINT
[
FK_Dim_Pelanggan_ID_Pelanggan
]
FOREIGN
KEY
([
ID_Pelanggan
])
REFERENCES
[
dbo
].[
Dim_Pelanggan
]
([
ID_Pelanggan
])
GO
ALTER
TABLE
[
dbo
].[
Fact_Penjualan
]
CHECK
CONSTRAINT
[
FK_Dim_Pelanggan_ID_Pelanggan
]
GO
ALTER
TABLE
[
dbo
].[
Fact_Penjualan
]
WITH
CHECK
ADD
CONSTRAINT
[
FK_Dim_Pembayaran_ID_Pembayaran
]
FOREIGN
KEY
([
ID_Pembayaran
])
REFERENCES
[
dbo
].[
Dim_Pembayaran
]
([
ID_Pembayaran
])
GO
ALTER
TABLE
[
dbo
].[
Fact_Penjualan
]
CHECK
CONSTRAINT
[
FK_Dim_Waktu_ID_Waktu
]
GO
ALTER
TABLE
[
dbo
].[
Fact_Penjualan
]
WITH
CHECK
ADD
CONSTRAINT
[
FK_Dim_Waktu_ID_Waktu
]
FOREIGN
KEY
([
ID_Waktu
])
REFERENCES
[
dbo
].[
Dim_Waktu
]
([
ID_Waktu
])
GO
ALTER
TABLE
[
dbo
].[
Fact_Penjualan
]
CHECK
CONSTRAINT
[
FK_Dim_Waktu_ID_Waktu
]
GO
CREATE
TABLE
[
dbo
].[
Fact_Pembelian
](
[
ID_Waktu
]
[
int
]
NOT
NULL
,
[
ID_Barang
]
[
int
]
NOT
NULL
,
[
ID_Supplier
]
[
int
]
NOT
NULL
,
[
ID_Pembayaran
]
[
int
]
NOT
NULL
,
[
PPN_Persen
]
[
decimal
]
NULL
,
[
PPN_Rupiah
]
[
decimal
]
NULL
,
[
Jlh_Barang_Jual
]
[
int
]
NULL
,
[
Jlh_Barang_Bayar
]
[
int
]
NULL
,
[
Jlh_Barang_Sebelum_Pajak
]
[
int
]
NULL
,
[
Jlh_Barang_Setelah_Pajak
]
[
int
]
NULL
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Waktu
]
ASC
,
[
ID_Barang
]
ASC
,
[
ID_Pembayaran
]
ASC
,
[
ID_Supplier
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
ON
[
PRIMARY
]
GO
ALTER
TABLE
[
dbo
].[
Fact_Pembelian
]
WITH
CHECK
ADD
CONSTRAINT
[
FK_Dim_Barang_ID_Barang
]
FOREIGN
KEY
([
ID_Barang
])
REFERENCES
[
dbo
].[
Dim_Barang
]
([
ID_Barang
])
GO
ALTER
TABLE
[
dbo
].[
Fact_Pembelian
]
CHECK
CONSTRAINT
[
FK_Dim_Barang_ID_Barang
]
GO
ALTER
TABLE
[
dbo
].[
Fact_Pembelian
]
WITH
CHECK
ADD
CONSTRAINT
[
FK_Dim_Supplier_ID_Supplier
]
FOREIGN
KEY
([
ID_Supplier
])
REFERENCES
[
dbo
].[
Dim_Supplier
]
([
ID_Supplier
])
GO
ALTER
TABLE
[
dbo
].[
Fact_Pembelian
]
CHECK
CONSTRAINT
[
FK_Dim_Supplier_ID_Supplier
]
GO
ALTER
TABLE
[
dbo
].[
Fact_Pembelian
]
WITH
CHECK
ADD
CONSTRAINT
[
FK_Dim_Pembayaran_ID_Pembayaran
]
FOREIGN
KEY
([
ID_Pembayaran
])
REFERENCES
[
dbo
].[
Dim_Pembayaran
]
([
ID_Pembayaran
])
GO
ALTER
TABLE
[
dbo
].[
Fact_Pembelian
]
CHECK
CONSTRAINT
[
FK_Dim_Waktu_ID_Waktu
]
GO
ALTER
TABLE
[
dbo
].[
Fact_Pembelian
]
WITH
CHECK
ADD
CONSTRAINT
[
FK_Dim_Waktu_ID_Waktu
]
FOREIGN
KEY
([
ID_Waktu
])
REFERENCES
[
dbo
].[
Dim_Waktu
]
([
ID_Waktu
])
GO
ALTER
TABLE
[
dbo
].[
Fact_Pembelian
]
CHECK
CONSTRAINT
[
FK_Dim_Waktu_ID_Waktu
]
GO
CREATE
TABLE
[
dbo
].[
Fact_Stock_Control
](
[
ID_Waktu
]
[
int
]
NOT
NULL
,
[
ID_Barang
]
[
int
]
NOT
NULL
,
[
ID_Gudang
]
[
int
]
NOT
NULL
,
[
Jlh_Barang_Masuk
]
[
int
]
NULL
,
[
Jlh_Barang_Keluar
]
[
int
]
NULL
,
[
Jlh_Barang_Sisa
]
[
int
]
NULL
,
PRIMARY
KEY
CLUSTERED
(
[
ID_Waktu
]
ASC
,
[
ID_Barang
]
ASC
,
[
ID_Gudang
]
ASC
)
WITH
(
PAD_INDEX
=
OFF
,
STATISTICS_NORECOMPUTE
=
OFF
,
IGNORE_DUP_KEY
=
OFF
,
ALLOW_ROW_LOCKS
=
ON
,
ALLOW_PAGE_LOCKS
=
ON
)
ON
[
PRIMARY
]
)
ON
[
PRIMARY
]
GO
ALTER
TABLE
[
dbo
].[
Fact_Stock_Control
]
WITH
CHECK
ADD
CONSTRAINT
[
FK_Dim_Gudang_ID_Gudang
]
FOREIGN
KEY
([
ID_Gudang
])
REFERENCES
[
dbo
].[
Dim_Gudang
]
([
ID_Gudang
])
GO
ALTER
TABLE
[
dbo
].[
Fact_Stock_Control
]
CHECK
CONSTRAINT
[
FK_Dim_Gudang_ID_Gudang
]
GO
ALTER
TABLE
[
dbo
].[
Fact_Stock_Control
]
WITH
CHECK
ADD
CONSTRAINT
[
FK_Dim_Waktu_ID_Waktu
]
FOREIGN
KEY
([
ID_Waktu
])
REFERENCES
[
dbo
].[
Dim_Waktu
]
([
ID_Waktu
])
GO
ALTER
TABLE
[
dbo
].[
Fact_Stock_Control
]
CHECK
CONSTRAINT
[
FK_Dim_Waktu_ID_Waktu
]
GO
ALTER
TABLE
[
dbo
].[
Fact_Stock_Control
]
WITH
CHECK
ADD
CONSTRAINT
[
FK_Dim_Barang_ID_Barang
]
FOREIGN
KEY
([
ID_Barang
])
REFERENCES
[
dbo
].[
Dim_Barang
]
([
ID_Barang
])
GO
ALTER
TABLE
[
dbo
].[
Fact_Stock_Control
]
CHECK
CONSTRAINT
[
FK_Dim_Barang_ID_Barang
]
GO
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment