COMPUTER LEARNING CENTER
WWW.HUUKHANG.COM
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5 )
LOG
ON
( NAME = 'Testlog',
FILENAME = 'c:\mssql7\data\Testlog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB )
GO
Ñeå ñôn giaûn hoaù caùc ñoái töôïng Table trong cô sôû döõ lieäu Test, chuùng toâi chæ trình baøy moät vaøi
phaùt bieåu SQL daïng Create Table, caùc Table khaùc baïn coù theå tìm thaáy trong cô sôû döõ lieäu ñính keøm.
Ví duï 8-32: Taïo moät soá baûng trong Test
/* Taïo baûng danh saùch khaùch haøng thöôøng xuyeân */
CREATE TABLE tblcustomers (
CustID int(3) unsigned NOT NULL auto_increment,
Username varchar(20) NOT NULL DEFAULT '' ,
Password varchar(10) NOT NULL DEFAULT '' ,
CustName varchar(50) ,
Address varchar(100) ,
Tel varchar(20) ,
FaxNo varchar(10) ,
Email varchar(50) ,
Contact varchar(50) ,
CountryCode char(3) ,
ProvinceCode char(3) ,
PRIMARY KEY (CustID),
INDEX CustID (CustID)
);
/* Taïo baûng hôïp ñoàng mua haøng qua maïng */
CREATE TABLE tblorders (
OrderID int(3) NOT NULL auto_increment,
OrderDate date ,
CustID int(11) ,
Description varchar(100) DEFAULT '0' ,
TranID tinyint(3) DEFAULT '0' ,
PaymentID tinyint(3) DEFAULT '0' ,
Amount float DEFAULT '0' ,
ShipCost float DEFAULT '0' ,
TotalAmount float DEFAULT '0' ,
PRIMARY KEY (OrderID),
INDEX OrderID (OrderID)
);
/* Taïo baûng hôïp ñoàng chi tieát mua haøng qua maïng */
CREATE TABLE tblorderdetails (
ItemID int(3) unsigned DEFAULT '0' ,
OrderID int(3) unsigned DEFAULT '0' ,
No tinyint(3) unsigned DEFAULT '0' ,
Qtty int(3) unsigned DEFAULT '0' ,
Price int(3) unsigned DEFAULT '0' ,
Discount int(3) unsigned DEFAULT '0' ,
Amount bigint(3) unsigned DEFAULT '0'
);
Giaùo vieân: Phaïm Höõu Khang