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

SQL

Scheduled Pinned Locked Moved The Lounge
databasevisual-studiocomsysadminfunctional
25 Posts 12 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 Marc Clifton

    Why, after all these years, is there still no standard for basic features of SQL. For example, the syntax for returning only [n] rows. Top vs Limit[^] This sort of stuff drives me nuts, as it requires a call out to the specific DB interface to properly generate the SQL for specific DB provider. Argh. And if you want to do something more complex, like offsets and limits, this[^] is a fun read illustrating the syntax differences. Marc

    Imperative to Functional Programming Succinctly Higher Order Programming

    J Offline
    J Offline
    Jeremy Falcon
    wrote on last edited by
    #3

    As said, vendor lock in. It was the same thing (sorta still is a bit) with the web for years. Everyone wants you to think "their way" is the best way.

    Jeremy Falcon

    L 1 Reply Last reply
    0
    • M Marc Clifton

      Why, after all these years, is there still no standard for basic features of SQL. For example, the syntax for returning only [n] rows. Top vs Limit[^] This sort of stuff drives me nuts, as it requires a call out to the specific DB interface to properly generate the SQL for specific DB provider. Argh. And if you want to do something more complex, like offsets and limits, this[^] is a fun read illustrating the syntax differences. Marc

      Imperative to Functional Programming Succinctly Higher Order Programming

      J Offline
      J Offline
      Jeremy Falcon
      wrote on last edited by
      #4

      LIMIT does make paging super easy. I know it's easier to do in SQL Server these days, but with LIMIT it's as easy as this:

      SELECT * FROM mytable LIMIT 50, 50;

      Assuming you're showing 50 records per page and currently viewing the second page.

      Jeremy Falcon

      1 Reply Last reply
      0
      • J Jeremy Falcon

        As said, vendor lock in. It was the same thing (sorta still is a bit) with the web for years. Everyone wants you to think "their way" is the best way.

        Jeremy Falcon

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #5

        Jeremy Falcon wrote:

        Everyone wants you to think "their way" is the best way.

        When we all know, my way is the only way.

        Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

        S 1 Reply Last reply
        0
        • M Marc Clifton

          Why, after all these years, is there still no standard for basic features of SQL. For example, the syntax for returning only [n] rows. Top vs Limit[^] This sort of stuff drives me nuts, as it requires a call out to the specific DB interface to properly generate the SQL for specific DB provider. Argh. And if you want to do something more complex, like offsets and limits, this[^] is a fun read illustrating the syntax differences. Marc

          Imperative to Functional Programming Succinctly Higher Order Programming

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #6

          Personally, I'd rather dump SQL completely, and go for a binary interface that doesn't let idiots leave themselves wide open to SQL Injection - but that's just crazy talk!

          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          J C P 3 Replies Last reply
          0
          • OriginalGriffO OriginalGriff

            Personally, I'd rather dump SQL completely, and go for a binary interface that doesn't let idiots leave themselves wide open to SQL Injection - but that's just crazy talk!

            Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

            J Offline
            J Offline
            Jeremy Falcon
            wrote on last edited by
            #7

            OriginalGriff wrote:

            but that's just crazy talk

            You're thinking way too progressive man. Might one wanna take time to cherish the old archaic way. This way we don't have to learn new concepts.

            Jeremy Falcon

            1 Reply Last reply
            0
            • OriginalGriffO OriginalGriff

              Personally, I'd rather dump SQL completely, and go for a binary interface that doesn't let idiots leave themselves wide open to SQL Injection - but that's just crazy talk!

              Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

              C Offline
              C Offline
              Chris Losinger
              wrote on last edited by
              #8

              writing code that writes code which gets interpreted at runtime in a black box is the modern way.

              image processing toolkits | batch image processing

              OriginalGriffO 1 Reply Last reply
              0
              • M Marc Clifton

                Why, after all these years, is there still no standard for basic features of SQL. For example, the syntax for returning only [n] rows. Top vs Limit[^] This sort of stuff drives me nuts, as it requires a call out to the specific DB interface to properly generate the SQL for specific DB provider. Argh. And if you want to do something more complex, like offsets and limits, this[^] is a fun read illustrating the syntax differences. Marc

                Imperative to Functional Programming Succinctly Higher Order Programming

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

                It's standardized since ISO SQL:2008 as the "FETCH FIRST" clause And it's starting to get support too, it's at the moment supported by atleast IBM DB2, PostgreSQL, Microsoft SQL Server 2012 and Oracle 12c.

                Wrong is evil and must be defeated. - Jeff Ello Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.

                P 1 Reply Last reply
                0
                • OriginalGriffO OriginalGriff

                  Personally, I'd rather dump SQL completely, and go for a binary interface that doesn't let idiots leave themselves wide open to SQL Injection - but that's just crazy talk!

                  Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #10

                  It'll never fly, Orville.

                  1 Reply Last reply
                  0
                  • C Chris Losinger

                    writing code that writes code which gets interpreted at runtime in a black box is the modern way.

                    image processing toolkits | batch image processing

                    OriginalGriffO Offline
                    OriginalGriffO Offline
                    OriginalGriff
                    wrote on last edited by
                    #11

                    I am sooooo tempted to have that as a sig! :laugh: :thumbsup:

                    Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                    1 Reply Last reply
                    0
                    • J Jorgen Andersson

                      It's standardized since ISO SQL:2008 as the "FETCH FIRST" clause And it's starting to get support too, it's at the moment supported by atleast IBM DB2, PostgreSQL, Microsoft SQL Server 2012 and Oracle 12c.

                      Wrong is evil and must be defeated. - Jeff Ello Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #12

                      Jörgen Andersson wrote:

                      "FETCH FIRST"

                      Isn't that only for cursors? Got a link to documentation?

                      J 2 Replies Last reply
                      0
                      • M Marc Clifton

                        Why, after all these years, is there still no standard for basic features of SQL. For example, the syntax for returning only [n] rows. Top vs Limit[^] This sort of stuff drives me nuts, as it requires a call out to the specific DB interface to properly generate the SQL for specific DB provider. Argh. And if you want to do something more complex, like offsets and limits, this[^] is a fun read illustrating the syntax differences. Marc

                        Imperative to Functional Programming Succinctly Higher Order Programming

                        P Offline
                        P Offline
                        PIEBALDconsult
                        wrote on last edited by
                        #13

                        I think the usage of TOP should be extended to include a SKIRT keyword to provide the OFFSET functionality.

                        J 1 Reply Last reply
                        0
                        • P PIEBALDconsult

                          Jörgen Andersson wrote:

                          "FETCH FIRST"

                          Isn't that only for cursors? Got a link to documentation?

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

                          Here[^]

                          Wrong is evil and must be defeated. - Jeff Ello Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.

                          R 1 Reply Last reply
                          0
                          • P PIEBALDconsult

                            I think the usage of TOP should be extended to include a SKIRT keyword to provide the OFFSET functionality.

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

                            And don't forget the REMOVE clause.

                            Wrong is evil and must be defeated. - Jeff Ello Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.

                            P 1 Reply Last reply
                            0
                            • P PIEBALDconsult

                              Jörgen Andersson wrote:

                              "FETCH FIRST"

                              Isn't that only for cursors? Got a link to documentation?

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

                              Naturally, MS messed up again by putting it together with the ORDER BY clause

                              Wrong is evil and must be defeated. - Jeff Ello Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.

                              1 Reply Last reply
                              0
                              • L Lost User

                                Jeremy Falcon wrote:

                                Everyone wants you to think "their way" is the best way.

                                When we all know, my way is the only way.

                                Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

                                S Offline
                                S Offline
                                Slacker007
                                wrote on last edited by
                                #17

                                Michael Martin wrote:

                                When we all know, my way is the only way.

                                there is always, "the highway".

                                1 Reply Last reply
                                0
                                • M Marc Clifton

                                  Why, after all these years, is there still no standard for basic features of SQL. For example, the syntax for returning only [n] rows. Top vs Limit[^] This sort of stuff drives me nuts, as it requires a call out to the specific DB interface to properly generate the SQL for specific DB provider. Argh. And if you want to do something more complex, like offsets and limits, this[^] is a fun read illustrating the syntax differences. Marc

                                  Imperative to Functional Programming Succinctly Higher Order Programming

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #18

                                  Marc Clifton wrote:

                                  Why, after all these years, is there still no standard for basic features of SQL

                                  There is a standard, as others will probably have pointed out. I've been using the ANSI 92 standard for personal projects; it is quite portable between different types of databases.

                                  Marc Clifton wrote:

                                  And if you want to do something more complex

                                  ..then I would not ask the DAL to do so.

                                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                                  P 1 Reply Last reply
                                  0
                                  • L Lost User

                                    Marc Clifton wrote:

                                    Why, after all these years, is there still no standard for basic features of SQL

                                    There is a standard, as others will probably have pointed out. I've been using the ANSI 92 standard for personal projects; it is quite portable between different types of databases.

                                    Marc Clifton wrote:

                                    And if you want to do something more complex

                                    ..then I would not ask the DAL to do so.

                                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                                    P Offline
                                    P Offline
                                    PIEBALDconsult
                                    wrote on last edited by
                                    #19

                                    Eddy Vluggen wrote:

                                    I would not ask the DAL to do so

                                    Exactly, that's an application responsibility.

                                    1 Reply Last reply
                                    0
                                    • J Jorgen Andersson

                                      And don't forget the REMOVE clause.

                                      Wrong is evil and must be defeated. - Jeff Ello Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.

                                      P Offline
                                      P Offline
                                      PIEBALDconsult
                                      wrote on last edited by
                                      #20

                                      That's applicable to the Basic Relational Architecture.

                                      J 1 Reply Last reply
                                      0
                                      • P PIEBALDconsult

                                        That's applicable to the Basic Relational Architecture.

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

                                        As is the Lookup Table

                                        Wrong is evil and must be defeated. - Jeff Ello Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.

                                        1 Reply Last reply
                                        0
                                        • J Jorgen Andersson

                                          Here[^]

                                          Wrong is evil and must be defeated. - Jeff Ello Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.

                                          R Offline
                                          R Offline
                                          RossMW
                                          wrote on last edited by
                                          #22

                                          Learn something new everyday... :)

                                          J 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