SvetlanaRedkina / Ranking-Companies

RANK(). DENSE_RANK(). ROW_NUMBER(). LEAD(), LAG().

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ranking-Companies

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 😊.

Companies.sql

  • 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

I am glad you have visited my project 🌹

About

RANK(). DENSE_RANK(). ROW_NUMBER(). LEAD(), LAG().

License:MIT License