Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Tutorial suggestion on SQL "partition over" and "dense_rank"?

Tutorial suggestion on SQL "partition over" and "dense_rank"?

Scheduled Pinned Locked Moved The Lounge
databasecomcollaborationtutorialquestion
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marc Clifton
    wrote on last edited by
    #1

    Any recommendations for a decent tutorial on these? I'm seeing them used in stuff the outsourcing team is writing, and in 20 years of writing SQL, I think I had to use "partition" once, and whatever I learned is long lost to age and time. :laugh:

    Latest Articles:
    DivWindow: Size, drag, minimize, and maximize floating windows with layout persistence

    J S M Sander RosselS 5 Replies Last reply
    0
    • M Marc Clifton

      Any recommendations for a decent tutorial on these? I'm seeing them used in stuff the outsourcing team is writing, and in 20 years of writing SQL, I think I had to use "partition" once, and whatever I learned is long lost to age and time. :laugh:

      Latest Articles:
      DivWindow: Size, drag, minimize, and maximize floating windows with layout persistence

      J Offline
      J Offline
      Jorgen Andersson
      wrote on last edited by
      #2

      This one[^] is as good as any. What all tutorials fail to mention is that windowing functions only live in the SELECT clause. This means that it cannot be used in the WHERE or HAVING clauses. (use a subquery or CTE instead) And more important, windowing always happen AFTER GROUP BY.

      Wrong is evil and must be defeated. - Jeff Ello

      M 1 Reply Last reply
      0
      • J Jorgen Andersson

        This one[^] is as good as any. What all tutorials fail to mention is that windowing functions only live in the SELECT clause. This means that it cannot be used in the WHERE or HAVING clauses. (use a subquery or CTE instead) And more important, windowing always happen AFTER GROUP BY.

        Wrong is evil and must be defeated. - Jeff Ello

        M Offline
        M Offline
        Marc Clifton
        wrote on last edited by
        #3

        Ok cool, thank you. Looks like a reasonable site. And thanks for the extra info as well.

        Latest Articles:
        DivWindow: Size, drag, minimize, and maximize floating windows with layout persistence

        J 1 Reply Last reply
        0
        • M Marc Clifton

          Ok cool, thank you. Looks like a reasonable site. And thanks for the extra info as well.

          Latest Articles:
          DivWindow: Size, drag, minimize, and maximize floating windows with layout persistence

          J Offline
          J Offline
          Jorgen Andersson
          wrote on last edited by
          #4

          Also, indexing works. Use a composite index with the fields in the PARTITION clause followed by the fields in the ORDER clause, in exactly the same order

          Wrong is evil and must be defeated. - Jeff Ello

          1 Reply Last reply
          0
          • M Marc Clifton

            Any recommendations for a decent tutorial on these? I'm seeing them used in stuff the outsourcing team is writing, and in 20 years of writing SQL, I think I had to use "partition" once, and whatever I learned is long lost to age and time. :laugh:

            Latest Articles:
            DivWindow: Size, drag, minimize, and maximize floating windows with layout persistence

            S Offline
            S Offline
            scottgp
            wrote on last edited by
            #5

            I always find Robert Sheldon's articles to be excellent, e.g. [[^]Working with Window Functions in SQL Server - Simple Talk](https://www.red-gate.com/simple-talk/databases/sql-server/learn/working-with-window-functions-in-sql-server/)

            1 Reply Last reply
            0
            • M Marc Clifton

              Any recommendations for a decent tutorial on these? I'm seeing them used in stuff the outsourcing team is writing, and in 20 years of writing SQL, I think I had to use "partition" once, and whatever I learned is long lost to age and time. :laugh:

              Latest Articles:
              DivWindow: Size, drag, minimize, and maximize floating windows with layout persistence

              S Offline
              S Offline
              scottgp
              wrote on last edited by
              #6

              I find Robert Sheldon's articles to be excellent, e.g. [Working with Window Functions in SQL Server - Simple Talk](https://www.red-gate.com/simple-talk/databases/sql-server/learn/working-with-window-functions-in-sql-server/)

              M 1 Reply Last reply
              0
              • M Marc Clifton

                Any recommendations for a decent tutorial on these? I'm seeing them used in stuff the outsourcing team is writing, and in 20 years of writing SQL, I think I had to use "partition" once, and whatever I learned is long lost to age and time. :laugh:

                Latest Articles:
                DivWindow: Size, drag, minimize, and maximize floating windows with layout persistence

                M Offline
                M Offline
                MarkTJohnson
                wrote on last edited by
                #7

                How about Find another way Partition clauses suck ?

                I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.

                1 Reply Last reply
                0
                • S scottgp

                  I find Robert Sheldon's articles to be excellent, e.g. [Working with Window Functions in SQL Server - Simple Talk](https://www.red-gate.com/simple-talk/databases/sql-server/learn/working-with-window-functions-in-sql-server/)

                  M Offline
                  M Offline
                  Marc Clifton
                  wrote on last edited by
                  #8

                  scottgp wrote:

                  I find Robert Sheldon's articles to be excellent, e.g.

                  Thank you!

                  Latest Articles:
                  DivWindow: Size, drag, minimize, and maximize floating windows with layout persistence

                  1 Reply Last reply
                  0
                  • M Marc Clifton

                    Any recommendations for a decent tutorial on these? I'm seeing them used in stuff the outsourcing team is writing, and in 20 years of writing SQL, I think I had to use "partition" once, and whatever I learned is long lost to age and time. :laugh:

                    Latest Articles:
                    DivWindow: Size, drag, minimize, and maximize floating windows with layout persistence

                    Sander RosselS Offline
                    Sander RosselS Offline
                    Sander Rossel
                    wrote on last edited by
                    #9

                    Whenever I'm stuck on a SQL problem I go to these awesome articles written by a very respectable and knowledgeable CP member (nice guy too, or so I've heard) :D Querying SQL Server 2012: Part I[^] Querying SQL Server 2012: Part II[^]

                    Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups