0% found this document useful (0 votes)
69 views2 pages

Create Database Qlbanhang

The document creates a database called QLBanHang and defines several tables to store product, supplier, order, import, export, and inventory information. The tables include VATTU to store product information, NHACC to store supplier information, DONDH to store order details, CTDONDH to store order line items, PNHAP to store import details, CTPNHAP to store import line items, PXUAT to store export details, CTPXUAT to store export line items, and TONKHO to store inventory levels by period. Primary keys are defined for each table.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views2 pages

Create Database Qlbanhang

The document creates a database called QLBanHang and defines several tables to store product, supplier, order, import, export, and inventory information. The tables include VATTU to store product information, NHACC to store supplier information, DONDH to store order details, CTDONDH to store order line items, PNHAP to store import details, CTPNHAP to store import line items, PXUAT to store export details, CTPXUAT to store export line items, and TONKHO to store inventory levels by period. Primary keys are defined for each table.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CREATE DATABASE QLBanHang

GO
USE QLBanHang
GO
CREATE TABLE VATTU
(
MaVTu CHAR(4) PRIMARY KEY,
TenVTu NVARCHAR(100),
DvTinh NVARCHAR(10),
PhanTram REAL
)
GO
CREATE TABLE NHACC
(
MaNhaCc Char(3) PRIMARY KEY,
TenNhaCc NVarChar(100),
DiaChi NVarChar(200),
DienThoai NVarChar(20)
)
GO
CREATE TABLE DONDH
(
SoDh Char(4) PRIMARY KEY,
NgayDh DATETIME,
MaNhaCc Char(3)
)
GO
CREATE TABLE CTDONDH
(
SoDh Char(4) PRIMARY KEY,
MaVTu CHAR(4) PRIMARY KEY,
SlDat INT,
)
GO
CREATE TABLE PNHAP
(
SoPn Char(4) PRIMARY KEY,
NgayNhap DATETIME,
SoDh Char(4),
)
GO
CREATE TABLE CTPNHAP
(
SoPn Char(4) PRIMARY KEY,
MaVTu CHAR(4) PRIMARY KEY,
SlNhap INT,
DgNhap MONEY,
)
GO
CREATE TABLE PXUAT
(
SoPx Char(4) PRIMARY KEY,
NgayXuat DATETIME,
TenKh NVarChar(100),
)
GO
CREATE TABLE CTPXUAT
(
SoPx Char(4) PRIMARY KEY,
MaVTu CHAR(4) PRIMARY KEY,
SlXuat INT,
DgXuat MONEY,
)
GO
CREATE TABLE TONKHO
(
NamThang Char(6) PRIMARY KEY,
MaVTu CHAR(4) PRIMARY KEY,
SLDau INT,
TongSLN INT,
TongSLX INT,
SLCuoi INT,
)
GO

You might also like