Exercise: E-commerce simple UML model I personally like to create a database after UML modeling. SQLSERVER is useless for some time. I would like to review the exercise code as follows: masterNOCOUNTON; dbo. sysdatabases) DatabaseOptimizationDatabaseOptimizationON (NAME, FILENAME, SIZE10, MAXSIZEUNLIMITE
Exercise: E-commerce simple UML model I personally like to create a database after UML modeling. SQL server is useless for some time. I would like to review the following code: master NOCOUNT ON; dbo. sysdatabases) DatabaseOptimization ON (NAME, FILENAME, SIZE = 10, MAXSIZE = UNLIMITE
Exercise:
Simple e-commerce UML Model
I personally like to create a database after UML modeling, and I haven't used SQL server for a while. I would like to review the following exercise code:
Master nocount on; dbo. sysdatabases) DatabaseOptimization ON (NAME, FILENAME, SIZE = 10, MAXSIZE = UNLIMITED, FILEGROWTH) log on (NAME, FILENAME, SIZE = 5 MB, MAXSIZE = UNLIMITED, FILEGROWTH) GOUSE DatabaseOptimization. () as random. (@ Sourcevarchar (256), @ PaddingChar (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); hour (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; ENDCLOSE CursorCustomer; DEALLOCATE CursorCustomer; invoke (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; ENDCLOSE CursorProductType; DEALLOCATE CursorProductType; invoke (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; ENDCLOSE CursorProductTypeWithLevel; DEALLOCATE CursorProductTypeWithLevel; invoke (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, @ resolve) CursorProduct INTO @ ProductCursorID, @ resolve, @ resolve; ENDCLOSE CursorProduct; DEALLOCATE CursorProduct; CursorOrder INTO @ OrderCursorID; ENDCLOSE CursorOrder; DEALLOCATE CursorOrder;