当前位置:Gxlcms > mysql > 电子商务-简单建模(练习篇)

电子商务-简单建模(练习篇)

时间:2021-07-01 10:21:17 帮助过:48人阅读

练习篇: 电子商务简单UML模型 个人喜欢UML建模后再建数据库,有段时间没用SQL SERVER,特此复习下,练习代码如下: master NOCOUNT ON ; dbo.sysdatabases ) DatabaseOptimization DatabaseOptimization ON (NAME ,FILENAME ,SIZE = 10 ,MAXSIZE = UNLIMITE

练习篇:

电子商务简单UML模型

个人喜欢UML建模后再建数据库,有段时间没用SQL SERVER,,特此复习下,练习代码如下:

master NOCOUNT ON; dbo.sysdatabases ) DatabaseOptimization DatabaseOptimization ON ( NAME , FILENAME , SIZE = 10, MAXSIZE = UNLIMITED, FILEGROWTH ) LOG ON( NAME , FILENAME , SIZE = 5MB, MAXSIZE = UNLIMITED, FILEGROWTH ) GO USE DatabaseOptimization .() AS RANDOM . ( @Source varchar(256), @PaddingChar char(1), @TotalLength tinyint ) RETURNS varchar(512) (LTRIM(@Source)); ) ; ; (@Source); ) ; (512); () . ( @Length tinyint ) () ; ; (38,0); ; () ; ; ; () FROM VIEW_RANDOM; RETURN @Return; . ( ) RETURNS varchar(30) (30); (,,,dbo.padleft( dbo.Random(,8) ; ; ; ; ; ; ; ; ; ; ; ; -------------------------------------------------------------------------------------------------------- --(sys.objects (N) ) .; .( , (20) NOT NULL, (40) NOT NULL, (40) NOT NULL, (20) NULL, (20) NULL, (100) NULL, (11) NULL, (6) NULL, (GETDATE()), (0) ); IX_CUSTOMER_NAME .(Name); ; ; .(,,) VALUES (dbo.PadLeft(),,dbo.PadLeft(),,,); ; --(sys.objects (N) ) .; .( (30) NOT NULL, , (50) NULL, (20) NULL, (100) NULL, (11) NULL, (6) NULL, (500) NULL, (GETDATE()), (0), (0), ); .PK_Order_OrderID ) ; .FK_Order_OrderID ) .() ; .(); ; ; (30); ; OPEN CursorCustomer; CursorCustomer INTO @CursorID; (RAND()*@OrderCount) ; PRINT @RandomCount; ; dbo.RandomValue(); PRINT @RandomOrderID; .(,CustomerID,PostingWay,Receiver,Address,Phone,) VALUES (@RandomOrderID, @CursorID, (), , , , ()); ; ; CursorCustomer INTO @CursorID; END CLOSE CursorCustomer; DEALLOCATE CursorCustomer; -------------------------------------------------------------------------------------------------------- --(sys.objects (N) ) .; .( , (100) NOT NULL, (100) NULL, , , , (1), (500) NULL, (GETDATE()) ); ; ; ; .(,,)VALUES(NULL,'',1); ; .(),(), ; ; CursorProductType .(); ; ; ; ; OPEN CursorProductType; CursorProductType INTO @TypeCursorID; SET NOCOUNT ON; (RAND()*@ProductTypeLevel2Count) ; PRINT @TypeRandomCount; ; .(,,)VALUES(@TypeCursorID,'',2); ; .(),(), ; ; ; CursorProductType INTO @TypeCursorID; END CLOSE CursorProductType; DEALLOCATE CursorProductType; -------------------------------------------------------------------------------------------------------- --(sys.objects (N) ) .; .( , (100) NOT NULL, (Max) NULL, , (38, 2) NULL, (38, 2) NULL, (200) NULL, , , (0), (8, 1) NULL DEFAULT (1), (GETDATE()), (GETDATE()), (1) ) .FK_Product_ProductTypeID_ProductType_ID ) .() ; CursorProductTypeWithLevel .(); ; ; ; ; OPEN CursorProductTypeWithLevel; CursorProductTypeWithLevel INTO @ProductTypeCursorID; SET NOCOUNT ON; (RAND()* @ProductRandomMax) ; PRINT @ProductTypeRandomCount; ; .(,,,,)VALUES( ,); ; .(),(), ; ; CursorProductTypeWithLevel INTO @ProductTypeCursorID; END CLOSE CursorProductTypeWithLevel; DEALLOCATE CursorProductTypeWithLevel; -------------------------------------------------------------------------------------------------------- --(sys.objects (N) ) .; .( , (30) NOT NULL, , (38, 2) NULL, ) .() .() ; .() .() ; .(); ; (30); (38,2); (8,1); ; OPEN CursorOrder; CursorOrder INTO @OrderCursorID; CursorProduct ,DiscountRate,SalePrice .(); OPEN CursorProduct; CursorProduct INTO @ProductCursorID,@ProductCursorDiscountRate,@ProductCursorSalePrice; (RAND()*50) ; . ( , , ,) VALUES ( @OrderCursorID ,@ProductCursorID , ,@DetailQuantity) CursorProduct INTO @ProductCursorID,@ProductCursorDiscountRate,@ProductCursorSalePrice; END CLOSE CursorProduct; DEALLOCATE CursorProduct; CursorOrder INTO @OrderCursorID; END CLOSE CursorOrder; DEALLOCATE CursorOrder;

人气教程排行