Ylbtech-dbs:ylbtech-2,pam (Personal asset Management system) |
-- =============================================
--Personal Assets Management (PAM)
--Personal asset management system
--Yuanbo
--21:45 2015/3/14
-- =============================================
1.A, Database diagram (db Diagram) back to top |
1.B, database design script back to top |
1.b.1,basic.sql
-- =============================================--Personal Assets Management (PAM)--Personal Asset Management system--Yuanbo--21:45 2015/3/14-- ============================================= UseMasterGO--Drop The database if it already existsIF EXISTS ( SELECTname fromsys.databasesWHEREName=N'Purplepam')DROP DATABASEPurplepamGOCREATE DATABASEPurplepamGO UsePurplepamGoGo-- =============================================--ylb:1, user location-- =============================================Go-- =============================================--ylb:1, Account-- =============================================Create TableAccount (AccountIdint Identity(101001,1)Primary Key,--ref. "ID,PK"Usernamevarchar( -),--User namePwdvarchar( -),--PasswordIntrovarchar( -),--Personal Signaturepubdatedatetime,--Registration Time[Disable] bit default(0)--whether 0 is disabled: normal; 1: Disabled)Go-- =============================================--ylb:1, category "Level 2"-- =============================================Create TableCategory (CategoryIdint Identity(101001,1)Primary Key,--ref. "ID,PK"Categerynamevarchar( -),--Category nameBaseIDint default(-1),--Parent IDFlagsystembit default(0),--System Classification 0: System (no operation); 1: UserFlagvisablebit default(0),--visible 0: visible; 1: Hidden[Disable] bit default(0),--whether 0 is disabled: normal; 1: DisabledAccountIdint --Account ID "FK")Go-- =============================================--ylb:1, tags-- =============================================Create TableLabel (Labelidint Identity(101,1)Primary Key,--ref. "ID,PK"LabelNamevarchar( -),--labelaccountIdint --Account ID "FK")Go-- =============================================--ylb:1, Commodity table (Asset table)-- =============================================Create TableProduct (ProductIdint Identity(101001,1)Primary Key,--ref. "ID,PK"ProductNamevarchar( -),--Product NameUnitPricedecimal(6,2),--Unit Price Number int,--QuantityAmountdecimal,--AmountRemarkvarchar( -),--NotesImgurlvarchar( -),--product Picture "Only one card allowed"pubdatedatetime,--Add TimePubdate2datetime,--Add TimePubdate3datetime,--Last Modified Date[Disable] bit default(0),--whether 0 is disabled: normal; 1: DisabledaccountIdint,--Account ID "FK"Categeryidint --Category ID "FK")Go-- =============================================--ylb:1, product label Relationship table-- =============================================Create TableProductlabel (Productlabelidint Identity(101,1)Primary Key,--ref. "ID,PK"ProductIdint,--Product ID "FK"Labelidint,--tag id "FK"accountIdint --Account ID "FK")
View Code
1.b.2,
1.C, functional implementation code (function implementation codes) back to top |
|
Ylbtech Source: http://ylbtech.cnblogs.com/ This article is copyright to the author and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility. |
Ylbtech-dbs:ylbtech-2,pam (Personal asset Management system)