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. I write the SQL wrong every time.

I write the SQL wrong every time.

Scheduled Pinned Locked Moved The Lounge
databasedesignhelp
34 Posts 19 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I'm so used to writing:

    SELECT * FROM [table name]

    That you can bet when it's time to delete I'll write:

    DELETE * FROM [table name]

    I no longer blame myself. I consider it a language design bug thingy.

    L M E G Mike HankeyM 11 Replies Last reply
    0
    • L Lost User

      I'm so used to writing:

      SELECT * FROM [table name]

      That you can bet when it's time to delete I'll write:

      DELETE * FROM [table name]

      I no longer blame myself. I consider it a language design bug thingy.

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

      I've found a very easy way to completely avoid making any mistakes in SQL: I don't use SQL.

      C R 2 Replies Last reply
      0
      • L Lost User

        I've found a very easy way to completely avoid making any mistakes in SQL: I don't use SQL.

        C Offline
        C Offline
        Colin Mullikin
        wrote on last edited by
        #3

        What's SQL...? :-\

        The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin

        L 1 Reply Last reply
        0
        • L Lost User

          I'm so used to writing:

          SELECT * FROM [table name]

          That you can bet when it's time to delete I'll write:

          DELETE * FROM [table name]

          I no longer blame myself. I consider it a language design bug thingy.

          M Offline
          M Offline
          Matt U
          wrote on last edited by
          #4

          I figured I was the only one so I was too embarrassed to ever post about it here. O.o

          djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

          C 1 Reply Last reply
          0
          • L Lost User

            I'm so used to writing:

            SELECT * FROM [table name]

            That you can bet when it's time to delete I'll write:

            DELETE * FROM [table name]

            I no longer blame myself. I consider it a language design bug thingy.

            E Offline
            E Offline
            Ennis Ray Lynch Jr
            wrote on last edited by
            #5

            Pretend it is because you thought your were writing for the Jet Engine. (which uses this)

            Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

            1 Reply Last reply
            0
            • L Lost User

              I'm so used to writing:

              SELECT * FROM [table name]

              That you can bet when it's time to delete I'll write:

              DELETE * FROM [table name]

              I no longer blame myself. I consider it a language design bug thingy.

              G Offline
              G Offline
              GenJerDan
              wrote on last edited by
              #6

              Always write the WHERE clause first, even if it doesn't need one. WHERE 1=2 is always a good choice until you've got the rest worked out. Me, what I usually screw up with is forgetting which database I'm on. Oh, you mean I just wiped the production database? Oops.

              No dogs or cats are in the classroom. My Mu[sic] My Films My Windows Programs, etc.

              L 1 Reply Last reply
              0
              • L Lost User

                I'm so used to writing:

                SELECT * FROM [table name]

                That you can bet when it's time to delete I'll write:

                DELETE * FROM [table name]

                I no longer blame myself. I consider it a language design bug thingy.

                Mike HankeyM Offline
                Mike HankeyM Offline
                Mike Hankey
                wrote on last edited by
                #7

                I use Squirrel a redneck SQL; GIMME what I need FROM [table name] DELETE what I don't need FROM [table name]

                VS2010/Atmel Studio 6.0 ToDo Manager Extension
                Version 3.0 now available. There is no place like 127.0.0.1

                C I 2 Replies Last reply
                0
                • L Lost User

                  I'm so used to writing:

                  SELECT * FROM [table name]

                  That you can bet when it's time to delete I'll write:

                  DELETE * FROM [table name]

                  I no longer blame myself. I consider it a language design bug thingy.

                  V Offline
                  V Offline
                  Vark111
                  wrote on last edited by
                  #8

                  I got into the habit of making myself look at the thing I wanted to delete before deleting.

                  F I 2 Replies Last reply
                  0
                  • G GenJerDan

                    Always write the WHERE clause first, even if it doesn't need one. WHERE 1=2 is always a good choice until you've got the rest worked out. Me, what I usually screw up with is forgetting which database I'm on. Oh, you mean I just wiped the production database? Oops.

                    No dogs or cats are in the classroom. My Mu[sic] My Films My Windows Programs, etc.

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

                    Solid advice but the ONLY time I ever use the delete command is to clear test database tables. I never use delete in production - everything is a log and if the user doesn't want to see it anymore a flag is set on the record. I was getting burned too often by people who would blame me for bad data. Every item and every change is logged and nothing is ever deleted. :^)

                    G I 2 Replies Last reply
                    0
                    • L Lost User

                      Solid advice but the ONLY time I ever use the delete command is to clear test database tables. I never use delete in production - everything is a log and if the user doesn't want to see it anymore a flag is set on the record. I was getting burned too often by people who would blame me for bad data. Every item and every change is logged and nothing is ever deleted. :^)

                      G Offline
                      G Offline
                      GenJerDan
                      wrote on last edited by
                      #10

                      :-D

                      No dogs or cats are in the classroom. My Mu[sic] My Films My Windows Programs, etc.

                      1 Reply Last reply
                      0
                      • C Colin Mullikin

                        What's SQL...? :-\

                        The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin

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

                        Colin Mullikin wrote:

                        What's SQL...?

                        An advanced language for querying databases that doesn't involve tons of ridiculously intricate frameworks and mysterious black box middle-tier software. Preferred by people who break out in a rash anytime something becomes more about the architecture then getting stuff done. ;P

                        C C D 3 Replies Last reply
                        0
                        • L Lost User

                          Colin Mullikin wrote:

                          What's SQL...?

                          An advanced language for querying databases that doesn't involve tons of ridiculously intricate frameworks and mysterious black box middle-tier software. Preferred by people who break out in a rash anytime something becomes more about the architecture then getting stuff done. ;P

                          C Offline
                          C Offline
                          Clifford Nelson
                          wrote on last edited by
                          #12

                          MehGerbil wrote:

                          An advanced language for querying databases

                          Don't know if I would call it advanced.

                          J 1 Reply Last reply
                          0
                          • L Lost User

                            Colin Mullikin wrote:

                            What's SQL...?

                            An advanced language for querying databases that doesn't involve tons of ridiculously intricate frameworks and mysterious black box middle-tier software. Preferred by people who break out in a rash anytime something becomes more about the architecture then getting stuff done. ;P

                            C Offline
                            C Offline
                            Colin Mullikin
                            wrote on last edited by
                            #13

                            MehGerbil wrote:

                            Preferred by people who break out in a rash anytime something becomes more about the architecture then getting stuff done

                            Water, meet monitor. :laugh: :laugh:

                            The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin

                            1 Reply Last reply
                            0
                            • L Lost User

                              I'm so used to writing:

                              SELECT * FROM [table name]

                              That you can bet when it's time to delete I'll write:

                              DELETE * FROM [table name]

                              I no longer blame myself. I consider it a language design bug thingy.

                              C Offline
                              C Offline
                              Clifford Nelson
                              wrote on last edited by
                              #14

                              Personally I use extension methods when writing LINQ, not the SQL like syntax. Anytime I see the SQL syntax my mind goes blank.

                              K 1 Reply Last reply
                              0
                              • L Lost User

                                I'm so used to writing:

                                SELECT * FROM [table name]

                                That you can bet when it's time to delete I'll write:

                                DELETE * FROM [table name]

                                I no longer blame myself. I consider it a language design bug thingy.

                                D Offline
                                D Offline
                                dexterama
                                wrote on last edited by
                                #15

                                But it's not really a 'bug thingy': You can select * (meaning all) or columns you name when selecting. When you Delete, it's the whole ROW, not columns, hence the */Column names aren't required. :-)

                                Think of how stupid the average person is, and realize half of them are stupider than that. - George Carlin

                                L 1 Reply Last reply
                                0
                                • Mike HankeyM Mike Hankey

                                  I use Squirrel a redneck SQL; GIMME what I need FROM [table name] DELETE what I don't need FROM [table name]

                                  VS2010/Atmel Studio 6.0 ToDo Manager Extension
                                  Version 3.0 now available. There is no place like 127.0.0.1

                                  C Offline
                                  C Offline
                                  Colin Mullikin
                                  wrote on last edited by
                                  #16

                                  They didn't teach us that variant in school... :laugh:

                                  The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin

                                  Mike HankeyM 1 Reply Last reply
                                  0
                                  • L Lost User

                                    I'm so used to writing:

                                    SELECT * FROM [table name]

                                    That you can bet when it's time to delete I'll write:

                                    DELETE * FROM [table name]

                                    I no longer blame myself. I consider it a language design bug thingy.

                                    C Offline
                                    C Offline
                                    Chris Meech
                                    wrote on last edited by
                                    #17

                                    Which is why I have replaced that with

                                    SELECT COUNT(ROWID) FROM [table_name]

                                    Sometimes that by itself will tell me all I need to know. :)

                                    Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

                                    1 Reply Last reply
                                    0
                                    • D dexterama

                                      But it's not really a 'bug thingy': You can select * (meaning all) or columns you name when selecting. When you Delete, it's the whole ROW, not columns, hence the */Column names aren't required. :-)

                                      Think of how stupid the average person is, and realize half of them are stupider than that. - George Carlin

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

                                      I bet you're a riot at parties. :-D

                                      1 Reply Last reply
                                      0
                                      • M Matt U

                                        I figured I was the only one so I was too embarrassed to ever post about it here. O.o

                                        djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

                                        C Offline
                                        C Offline
                                        Corporal Agarn
                                        wrote on last edited by
                                        #19

                                        Yet you quote a DBA. :-D

                                        M 1 Reply Last reply
                                        0
                                        • C Corporal Agarn

                                          Yet you quote a DBA. :-D

                                          M Offline
                                          M Offline
                                          Matt U
                                          wrote on last edited by
                                          #20

                                          Oh, you weren't supposed to see that. :)

                                          djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

                                          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