T-SQL Skills: Loading Millions Of Rows Of Test Data In Seconds

  Рет қаралды 9,536

Jeff Zuerlein

Jeff Zuerlein

Күн бұрын

Most tools that generate test data do so iteratively. But SQL loves set based operations. With a little T-SQL know how, you can create millions of rows of test data in seconds.
You can even leverage public data sources to create more realistic data that conforms to your applications business rules.
No third party tools, just a handful of queries. I’m keeping it simple.
#sql #csharp #testing #database
Blog:
betterwithcode.com/
LinkedIn:
/ jeff-zuerlein-2aa67b7
00:00 Introduction
00:13 Why you should generate test data.
01:11 How much data do you need?
01:48 Fake Data
02:48 Sql loves set based operations.
04:05 Fill the table with fake data.
05:38 Realistic test data
06:23 Populating a parent & child tables.
07:39 Leveraging modulus
08:38 Joining with a case statement.
10:45 Let SQL cook.

Пікірлер: 15
@mattserdar6599
@mattserdar6599 Ай бұрын
With privacy being a top concern, this is a great way to not fall in to the trap of using real customer data simply because "it's easy or we've always done it that way before". Well done Jeff!
@JeffZuerlein
@JeffZuerlein Ай бұрын
Great point! The last thing you want to do is leak sensitive data, or interact with real customers when you’re testing.
@thefastjojo
@thefastjojo Ай бұрын
Nice content Jeff! Your explanation helped me to test a bottleneck in a LINQ code I had in the ORM of my application.
@JeffZuerlein
@JeffZuerlein Ай бұрын
That's the best feedback I could get. Glad I was able to help you out!
@dsfgato
@dsfgato Ай бұрын
You’re a legend!! Your content is priceless! Thanks 🤘🏻
@JeffZuerlein
@JeffZuerlein Ай бұрын
That warms my heart. Glad I can help!
@everyonesview
@everyonesview Ай бұрын
Appreciate you sharing this. Thanks. More of this, please?
@JeffZuerlein
@JeffZuerlein Ай бұрын
Well I appreciate the feedback, and yes I will be making more!
@cuongphung9163
@cuongphung9163 Ай бұрын
Thanks! I have leant a lot
@JeffZuerlein
@JeffZuerlein Ай бұрын
Glad to hear it!
@PerMadsen-tg1ik
@PerMadsen-tg1ik Ай бұрын
Great video - very useful for testing databases. As far as I can tell you don’t really utilize to Qty column is you script and the created data just get equally distributed. Do you have a sample of you script where you show the use of Qty?
@JeffZuerlein
@JeffZuerlein Ай бұрын
If anyone is interested in learning more about generating test data with a distribution of values, like this comment. That way I know how much interest there is in it.
@JeffZuerlein
@JeffZuerlein Ай бұрын
It works better with a small number of discrete values, like states. If 10% of the population lived in CA, you could create a new seed table with 1000 rows, and 100 would have the value CA. If WY had 1% of the population, it would get 10 rows. Then you can join the new seed table to the numbers table and generate values. If there are lots of discrete values like names of people....The volume of data gets too big, and it slows down.
When Testing DateTime With SQL == Broken
2:30
Jeff Zuerlein
Рет қаралды 241
Testcontainers have forever changed the way I write tests
12:11
Dreams of Code
Рет қаралды 105 М.
When someone reclines their seat ✈️
00:21
Adam W
Рет қаралды 17 МЛН
I Built a Shelter House For myself and Сat🐱📦🏠
00:35
TooTool
Рет қаралды 21 МЛН
Как быстро замутить ЭлектроСамокат
00:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 12 МЛН
Span of T vs. Memory of T
9:44
Jeff Zuerlein
Рет қаралды 6 М.
6 SQL Joins you MUST know! (Animated + Practice)
9:47
Anton Putra
Рет қаралды 93 М.
10 Coding Principles Explained in 5 Minutes
5:44
ByteByteGo
Рет қаралды 114 М.
Learn Database Normalization - 1NF, 2NF, 3NF, 4NF, 5NF
28:34
Decomplexify
Рет қаралды 1,7 МЛН
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 966 М.
Lecture 1: Introduction to CS and Programming Using Python
1:03:30
MIT OpenCourseWare
Рет қаралды 407 М.
This Is Why Managers Don't Trust Programmers...
28:04
Thriving Technologist
Рет қаралды 169 М.
CS50x 2024 - Lecture 7 - SQL
2:14:05
CS50
Рет қаралды 357 М.
What model of phone do you have?
0:16
Hassyl Joon
Рет қаралды 73 М.
Mi primera placa con dios
0:12
Eyal mewing
Рет қаралды 516 М.
POCO F6 PRO - ЛУЧШИЙ POCO НА ДАННЫЙ МОМЕНТ!
18:51
Iphone or nokia
0:15
rishton vines😇
Рет қаралды 566 М.
Pratik Cat6 kablo soyma
0:15
Elektrik-Elektronik
Рет қаралды 8 МЛН