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.
On this page of the site you can watch the video online SQL Tutorial - Creating a sample of data with a duration of hours minute second in good quality, which was uploaded by the user BeardedDev 06 April 2018, share the link with friends and acquaintances, this video has already been watched 7,492 times on youtube and it was liked by 164 viewers. Enjoy your viewing!