SQL Tutorial - Creating a sample of data

Pubblicato il: 06 aprile 2018
sul canale di: BeardedDev
7,492
164

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.


In questa pagina del sito puoi guardare il video online SQL Tutorial - Creating a sample of data della durata di ore minuti seconda in buona qualità , che l'utente ha caricato BeardedDev 06 aprile 2018, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 7,492 volte e gli è piaciuto 164 spettatori. Buona visione!