Another video brought to you by BeardedDev, bringing you tutorials on Business Intelligence, SQL Programming and Data Analysis.
In this video I talk about how to create a sample set of data to work in Microsoft SQL Server. Creating a sample set of data can be extremely beneficial for development or testing, there is no need to wait minutes or hours for queries to run.
The techniques explored in this SQL Server Tutorial are:
NTILE - if you have are new to working with NTILE check out this video: • SQL Tutorial - Window Functions - Ranking
Nested CTEs - if you are new to working with CTEs check out this video: • SQL TUTORIAL - CTEs Part 1
Or for a full tutorial on CTEs check out this playlist:
Aggregate Functions - if you are new to working with Aggregate Functions and the GROUP BY clause check out this video: • SQL TUTORIAL - GROUP BY, HAVING, Aggregate...
SELECT * INTO
SQL Queries in the video:
WITH Number
AS
(
SELECT
CustomerId
, NTILE(1000) OVER(ORDER BY CustomerId) AS N
FROM dbo.Customers
)
,
TopCustomer
AS
(
SELECT
MAX(CustomerId) AS CustId
FROM Number
GROUP BY N
)
SELECT
C2.*
INTO dbo.CustomersSample
FROM TopCustomer AS C1
INNER JOIN dbo.Customers AS C2
ON C1.CustId = C2.CustomerId
SELECT * FROM dbo.CustomersSample
Please feel free to post comments.
Auf dieser Seite können Sie das Online-Video SQL Tutorial - Creating a sample of data mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer BeardedDev 06 April 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 7,492 Mal angesehen und es wurde von 164 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!