Ranking functions are super helpful 👍 in SQL but can sometimes be confusing. This is how I came up with an idea of this project ✨. I wanted ranking functions to become one of my strengths 💪, so I would use these functions inside my derived tables or CTE. I would be glad if my project benefited someone else 😊.
-
You will find three tables in the Companies.sql: Companies, projectDates, and petCompanies.
-
Each query in the Companies.sql achieves a certain task and includes explanations of the similarities and differencies between ranking functions:
1️⃣ rank() and rank() with partition by
2️⃣ dense_rank() and dense_rank() with partition by
3️⃣ row_number() and row_number() with partition by
4️⃣ lead() and lag()
-
The screenshots of the tables show how the tables look after values have been inserted into them.
Authors
Honest feedback
- If you have any feedback, please reach out to me at sveta.hq@gmail.com
I am glad you have visited my project 🌹