- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
qr code generator c# e xercise 2 in Visual C#.NET
e xercise 2 Making Denso QR Bar Code In Visual C# Using Barcode encoder for VS .NET Control to generate, create QR Code ISO/IEC18004 image in VS .NET applications. www.OnBarcode.comQuick Response Code Reader In Visual C# Using Barcode decoder for .NET Control to read, scan read, scan image in Visual Studio .NET applications. www.OnBarcode.comTune the Query by Using Clustered Indexes
Making Bar Code In C#.NET Using Barcode drawer for .NET Control to generate, create bar code image in VS .NET applications. www.OnBarcode.comRead Bar Code In Visual C# Using Barcode reader for Visual Studio .NET Control to read, scan read, scan image in .NET framework applications. www.OnBarcode.comIn this exercise, you optimize the query by modifying the primary key constraints to be nonclustered indexes and then creating appropriate clustered indexes. Creating QR Code 2d Barcode In .NET Using Barcode encoder for ASP.NET Control to generate, create QR Code image in ASP.NET applications. www.OnBarcode.comDenso QR Bar Code Generator In .NET Using Barcode generator for .NET Control to generate, create QR Code image in Visual Studio .NET applications. www.OnBarcode.com1. 2. QR Code ISO/IEC18004 Drawer In Visual Basic .NET Using Barcode printer for .NET Control to generate, create QR Code 2d barcode image in Visual Studio .NET applications. www.OnBarcode.comMaking EAN / UCC - 13 In C#.NET Using Barcode creation for VS .NET Control to generate, create EAN / UCC - 13 image in .NET applications. www.OnBarcode.comOpen SSMS, if necessary, and connect to the appropriate instance of SQL Server 2008. In a new query window, type and execute the following SQL statements to create the TestDB database, the Test schema, and the two tables that are used in this exercise: Matrix 2D Barcode Creator In C#.NET Using Barcode maker for Visual Studio .NET Control to generate, create 2D Barcode image in .NET framework applications. www.OnBarcode.comPrint 1D Barcode In Visual C#.NET Using Barcode generation for VS .NET Control to generate, create 1D image in VS .NET applications. www.OnBarcode.comCREATE DATABASE TestDB; GO
Barcode Generation In C# Using Barcode printer for Visual Studio .NET Control to generate, create bar code image in .NET framework applications. www.OnBarcode.comDraw UCC - 14 In C#.NET Using Barcode printer for .NET framework Control to generate, create ITF14 image in .NET applications. www.OnBarcode.comUSE TestDB; GO
Recognize QR Code In VB.NET Using Barcode recognizer for .NET framework Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comDraw Barcode In .NET Framework Using Barcode creator for Reporting Service Control to generate, create barcode image in Reporting Service applications. www.OnBarcode.comLesson 2: Creating Indexes
Drawing PDF-417 2d Barcode In .NET Using Barcode generator for Reporting Service Control to generate, create PDF417 image in Reporting Service applications. www.OnBarcode.comUPC Symbol Encoder In Java Using Barcode creation for Android Control to generate, create UPC Code image in Android applications. www.OnBarcode.comCREATE SCHEMA Test; GO
Quick Response Code Maker In Java Using Barcode creation for BIRT reports Control to generate, create QR Code image in BIRT reports applications. www.OnBarcode.comDrawing PDF-417 2d Barcode In Visual Studio .NET Using Barcode creator for VS .NET Control to generate, create PDF417 image in Visual Studio .NET applications. www.OnBarcode.comSELECT * INTO Test.SalesOrderHeader FROM AdventureWorks.Sales.SalesOrderHeader; GO
Matrix 2D Barcode Creator In Java Using Barcode maker for Java Control to generate, create 2D Barcode image in Java applications. www.OnBarcode.comGenerate GTIN - 12 In Objective-C Using Barcode creation for iPad Control to generate, create UPC Symbol image in iPad applications. www.OnBarcode.comSELECT * INTO Test.SalesOrderDetail FROM AdventureWorks.Sales.SalesOrderDetail; GO
ALTER TABLE Test.SalesOrderHeader ADD CONSTRAINT PKSalesOrderHeader PRIMARY KEY(SalesOrderID); GO
ALTER TABLE Test.SalesOrderDetail ADD CONSTRAINT PKSalesOrderDetail PRIMARY KEY(SalesOrderDetailID); In the existing query window, type, highlight, and execute the following SQL statements to modify the primary key constraint on the Test.SalesOrderHeader table to become a nonclustered index and then create an appropriate clustered index for the query: -- Modify the PK to be a non-clustered index. ALTER TABLE Test.SalesOrderHeader DROP CONSTRAINT PKSalesOrderHeader; ALTER TABLE Test.SalesOrderHeader ADD CONSTRAINT PKSalesOrderHeader PRIMARY KEY NONCLUSTERED (SalesOrderID); -- Create the clustered index. CREATE CLUSTERED INDEX CluIdx ON Test.SalesOrderHeader (TerritoryID, CustomerID); In the existing query window, type, highlight, and execute the following SQL statements to modify the primary key constraint on the Test.SalesOrderDetail table to become a nonclustered index and then create an appropriate clustered index for the query: -- Modify the PK to be a non-clustered index. ALTER TABLE Test.SalesOrderDetail DROP CONSTRAINT PKSalesOrderDetail; Techniques to Improve Query Performance
ALTER TABLE Test.SalesOrderDetail ADD CONSTRAINT PKSalesOrderDetail PRIMARY KEY NONCLUSTERED (SalesOrderDetailID); -- Create the clustered index. CREATE CLUSTERED INDEX CluIdx ON Test.SalesOrderDetail (SalesOrderID); 5. 6. Turn on the Actual Execution Plan feature in SSMS by pressing Ctrl+M or by selecting Include Actual Execution Plan from the Query menu. In the existing query window, type, highlight, and execute the following SQL statement to turn on the reporting of page reads: SET STATISTICS IO ON; In the existing query window, type, highlight, and execute the following SQL statement: SELECT soh.CustomerID ,SUM(sod.OrderQty * sod.UnitPrice) AS TotalPurchases FROM Test.SalesOrderHeader AS soh INNER JOIN Test.SalesOrderDetail AS sod ON sod.SalesOrderID = soh.SalesOrderID WHERE soh.TerritoryID = 1 GROUP BY soh.CustomerID; Record the total cost of the query. Record the total number of page reads for the query.
In the existing query window, type, highlight, and execute the following SQL statement to clean up after this exercise: USE master; DROP DATABASE TestDB; e xercise 3
Tune the Query by Using Covered Nonclustered Indexes
In this exercise, you optimize the query by creating covered nonclustered indexes.
1. 2. Open SSMS, if necessary, and connect to the instance of SQL Server 2008 running on your machine. In a new query window, type and execute the following SQL statements to create the TestDB database, the Test schema, and the two tables that are used in this exercise: CREATE DATABASE TestDB; GO
USE TestDB; GO
Lesson 2: Creating Indexes
CREATE SCHEMA Test; GO
SELECT * INTO Test.SalesOrderHeader FROM AdventureWorks.Sales.SalesOrderHeader; GO
SELECT * INTO Test.SalesOrderDetail FROM AdventureWorks.Sales.SalesOrderDetail; GO
ALTER TABLE Test.SalesOrderHeader ADD CONSTRAINT PKSalesOrderHeader PRIMARY KEY(SalesOrderID); GO
ALTER TABLE Test.SalesOrderDetail ADD CONSTRAINT PKSalesOrderDetail PRIMARY KEY(SalesOrderDetailID); In the existing query window, type, highlight, and execute the following SQL statement to create the covered nonclustered index that will be used by the query when accessing the Test.SalesOrderHeader table: CREATE NONCLUSTERED INDEX TestIndex ON Test.SalesOrderHeader (TerritoryID, SalesOrderID) INCLUDE (CustomerID); In the existing query window, type, highlight, and execute the following SQL statement to create the covered nonclustered index that will be used by the query when accessing the Test.SalesOrderDetail table: CREATE NONCLUSTERED INDEX TestIndex ON Test.SalesOrderDetail (SalesOrderID) INCLUDE (OrderQty, UnitPrice); 5. 6. Turn on the Actual Execution Plan feature in SSMS by pressing Ctrl+M or by selecting Include Actual Execution Plan from the Query menu. In the existing query window, type, highlight, and execute the following SQL statement to turn on the reporting of page reads: SET STATISTICS IO ON; In the existing query window, type, highlight, and execute the following SQL statement: SELECT soh.CustomerID ,SUM(sod.OrderQty * sod.UnitPrice) AS TotalPurchases
Techniques to Improve Query Performance
FROM Test.SalesOrderHeader AS soh INNER JOIN Test.SalesOrderDetail AS sod ON sod.SalesOrderID = soh.SalesOrderID WHERE soh.TerritoryID = 1 GROUP BY soh.CustomerID; Record the total cost of the query. Record the total number of page reads for the query.
In the existing query window, type, highlight, and execute the following SQL statement to clean up after this exercise: USE master; DROP DATABASE TestDB; e xercise 4
Tune the Query by Implementing an Indexed View
In this exercise, you optimize the query by creating an indexed view to cover the query.
1. 2. Open SSMS, if necessary, and connect to the appropriate instance of SQL Server 2008. In a new query window, type and execute the following SQL statements to create the TestDB database, the Test schema, and the two tables that are used in this exercise:
|
|