T-SQL: How To Use PARTITION BY and Why

  • In the examples, we’ll notice that we’re using a table with mixed values — some completely new in one column and another column with duplicates. These demos are live, so we are using live data.
  • What is the difference between partitioning by the column ID and the column Letter?
  • What happens when we insert a new record that is duplicate in both ID, Letter, and Val? How does the PARTITION BY with ROW_NUMBER() function here?
  • While people tend to think of PARTITION BY as helpful to remove duplicates, how would this functionality possibly help us with scaling horizontally and why?




Data | Development | Security.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

My First 100 Days at Afresh

Build a HA Pritunl service on GKE

Learn Python By Making Animated Clock With Graphics.PY Library

End of Week 3 @ The Hacking School

CS371p Spring 2020: Kevin Hao

🎉AMA Ark Rvials x BTA

Livepeer Explorer New Features Roundup

Considering Scala?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
SQLInSix Minutes

SQLInSix Minutes

Data | Development | Security.

More from Medium

Creating your own SQL Engine — Guide to deciphering any unfamiliar database

Static VS Dynamic SQL


How to export all Views from a database

How to export all Views from a database

What is PL/SQL? Why use PL/SQL over SQL.