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. what's your SQL resources (beginner)

what's your SQL resources (beginner)

Scheduled Pinned Locked Moved The Lounge
databasedevopshelptutorialquestion
16 Posts 16 Posters 15 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
    Maximilien
    wrote on last edited by
    #1

    So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

    CI/CD = Continuous Impediment/Continuous Despair

    R P R OriginalGriffO K 12 Replies Last reply
    0
    • M Maximilien

      So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

      CI/CD = Continuous Impediment/Continuous Despair

      R Offline
      R Offline
      Richard Deeming
      wrote on last edited by
      #2

      You could start here: Visual Representation of SQL Joins[^]


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      1 Reply Last reply
      0
      • M Maximilien

        So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

        CI/CD = Continuous Impediment/Continuous Despair

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

        If SQL Server... For simple things, you could try using SSMS' visual designer for creating a view.

        1 Reply Last reply
        0
        • M Maximilien

          So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

          CI/CD = Continuous Impediment/Continuous Despair

          R Offline
          R Offline
          Ron Nicholson
          wrote on last edited by
          #4

          Fresh from Eric Darling[^]. It talks about Joins.

          Jack of all trades, master of none, though often times better than master of one.

          R 1 Reply Last reply
          0
          • R Ron Nicholson

            Fresh from Eric Darling[^]. It talks about Joins.

            Jack of all trades, master of none, though often times better than master of one.

            R Offline
            R Offline
            Ravi Bhavnani
            wrote on last edited by
            #5

            I’m not going to talk about right outer joins, because that’s the foolish domain of characterless buffoons who use Venn diagrams to explain join results. :laugh: /ravi

            My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

            1 Reply Last reply
            0
            • M Maximilien

              So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

              CI/CD = Continuous Impediment/Continuous Despair

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

              I generally start with W3Schools SQL Tutorial[^] - they explain the basics, and provide DB samples and sandboxes so you can try it yourself without installing the heavyweight monster that is Sql Server. Basically, SQL is a relational DB - it works with multiple tables to relate data to other data, unlike for example CSV which is a flat self contained file where all related data in combined into a single row. So you can have an Invoices table (which holds the invoice date, customer, delivery address, and taxes / total owed) and a InvoiceLines table (which holds the items that were purchased: product, unit price, quantity, discount, Item total, InvoiceID). To look at a whole invoice, you use a JOIN:

              SELECT i.InvoiceDate, i.Total, i.PaidStatus, l.Product, l.UP, l.QTY, l.Disc, l.itemTotal
              FROM Invoices i
              JOIN InvoiceLines l ON l.InvoiceID = i.ID
              WHERE i.ID = 123456

              The InvoiceID relates the two bits of information and returns only the relevant data.

              "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 AntiTwitter: @DalekDave is now a follower!

              "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

              S 1 Reply Last reply
              0
              • M Maximilien

                So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

                CI/CD = Continuous Impediment/Continuous Despair

                K Offline
                K Offline
                kmoorevs
                wrote on last edited by
                #7

                I used get daily quizzes from SQLServerCentral – The #1 SQL Server community[^] and learned a lot from them. I've been writing SQL queries my entire career (25 years) and learn something new all the time. Good luck! :) FWIW, especially for a beginner, the query designer in Access is easier to work with than the query designer in SSMS. Just my 2 cents, I'm sure I'll catch hell for this comment. :-D ;P

                "Go forth into the source" - Neal Morse "Hope is contagious"

                B 1 Reply Last reply
                0
                • M Maximilien

                  So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

                  CI/CD = Continuous Impediment/Continuous Despair

                  J Offline
                  J Offline
                  jochance
                  wrote on last edited by
                  #8

                  MS Access... Or anything that lets you visually design your query and then flip to SQL to see the SQL generated for what you did. For a beginner, I think you'll pick up more and faster doing it that way than just googling/reading docs.

                  1 Reply Last reply
                  0
                  • M Maximilien

                    So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

                    CI/CD = Continuous Impediment/Continuous Despair

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

                    I find books with "Recipes" in the title useful; as in: "SQL Cookbook". The "Q&A" format (by "category") is the least time wasting when looking for a solution or insight into one.

                    "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

                    1 Reply Last reply
                    0
                    • M Maximilien

                      So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

                      CI/CD = Continuous Impediment/Continuous Despair

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

                      I use my own articles: Querying SQL Server 2012: Part I[^] Querying SQL Server 2012: Part II[^] It's starts with the basics, explaining SELECT ... FROM ... and then goes into WHERE, JOIN, GROUP BY, etc. I use it when I need something more exotic, like a grouping set, windowing function or pivot.

                      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
                      • M Maximilien

                        So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

                        CI/CD = Continuous Impediment/Continuous Despair

                        M Offline
                        M Offline
                        Mircea Neacsu
                        wrote on last edited by
                        #11

                        I'm not a database person myself, so I was probably in the same situation as you when it came to figuring out joins and stuff. I ended up creating a mental image that I found useful. For what it's worth, here it is: JOIN = add columns of table B to the columns of table A getting a wider table. columns used in join = imagine column from table A as "red" data and column from table B as "green" data Arrange rows in table to have first those where both red and green data are equal. Continue with remaining rows in table A (only red data, green data is empty). Finish with remaining rows in table B (only green data). Now: - INNER JOIN = take only the first part where red and green are equal - LEFT JOIN = take first two parts (the equal and other red rows) - RIGHT JOIN = take first and 3rd parts (the equal and green rows) - OUTER JOIN = take all. Just my 0.02$

                        Mircea

                        1 Reply Last reply
                        0
                        • M Maximilien

                          So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

                          CI/CD = Continuous Impediment/Continuous Despair

                          M Offline
                          M Offline
                          MSBassSinger
                          wrote on last edited by
                          #12

                          My resources (which I suspect many, many database developers or software engineers that also develop T-SQL do in some form or fashion) are: * Brain - by understanding and visualizing what the data design and queries/statements are doing helps eliminate a lot of bad ideas and wasted time. * SSMS - still the most comprehensive and easiest to use, IMHO, though sometimes I use the DB tools in Visual Studio. * SQL Server - I've tried others, but the support costs for multiple DB providers in the latter part of the SDLC for the customer are higher (in almost all use cases) that just using SQL Server correctly for the task at hand. * Consistency - solving the same problem with the same design, unless a newer design is demonstrably better in terms of execution, resources, and supportability. * CRUD - I limit my use of SQL Server (or any DB server) to CRUD (or in more common SQL terms, SELECT, INSERT, UPDATE, and DELETE) and leave the business logic to the C# code executing on the server or in the cloud app service. Database servers are designed to optimize reading and writing of data, not running business logic because it is easier to "just stick it all in the SQL".

                          1 Reply Last reply
                          0
                          • OriginalGriffO OriginalGriff

                            I generally start with W3Schools SQL Tutorial[^] - they explain the basics, and provide DB samples and sandboxes so you can try it yourself without installing the heavyweight monster that is Sql Server. Basically, SQL is a relational DB - it works with multiple tables to relate data to other data, unlike for example CSV which is a flat self contained file where all related data in combined into a single row. So you can have an Invoices table (which holds the invoice date, customer, delivery address, and taxes / total owed) and a InvoiceLines table (which holds the items that were purchased: product, unit price, quantity, discount, Item total, InvoiceID). To look at a whole invoice, you use a JOIN:

                            SELECT i.InvoiceDate, i.Total, i.PaidStatus, l.Product, l.UP, l.QTY, l.Disc, l.itemTotal
                            FROM Invoices i
                            JOIN InvoiceLines l ON l.InvoiceID = i.ID
                            WHERE i.ID = 123456

                            The InvoiceID relates the two bits of information and returns only the relevant data.

                            "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 AntiTwitter: @DalekDave is now a follower!

                            S Offline
                            S Offline
                            Steve Naidamast
                            wrote on last edited by
                            #13

                            I would second W3Schools! It has very helpful learning tools that I still rely on at times when I am trying to remember how to do something...

                            Steve Naidamast Sr. Software Engineer Black Falcon Software, Inc. blackfalconsoftware@outlook.com

                            1 Reply Last reply
                            0
                            • K kmoorevs

                              I used get daily quizzes from SQLServerCentral – The #1 SQL Server community[^] and learned a lot from them. I've been writing SQL queries my entire career (25 years) and learn something new all the time. Good luck! :) FWIW, especially for a beginner, the query designer in Access is easier to work with than the query designer in SSMS. Just my 2 cents, I'm sure I'll catch hell for this comment. :-D ;P

                              "Go forth into the source" - Neal Morse "Hope is contagious"

                              B Offline
                              B Offline
                              bryanren
                              wrote on last edited by
                              #14

                              I was trying to work up the courage to suggest MS Access - fearing that same heck. Bring your data, or let it build a template application for you. Visually design your query, then change to the SQL view and figure out what it is doing. You can write SQL that the visual designer cannot present (eg. sub-select). You cannot write all SQL (eg. cartesian join). Whilst you may not want to deploy it as an application (I have), it works to model or proof-of-concept for a business app. b

                              1 Reply Last reply
                              0
                              • M Maximilien

                                So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

                                CI/CD = Continuous Impediment/Continuous Despair

                                N Offline
                                N Offline
                                nickpreston24
                                wrote on last edited by
                                #15

                                "

                                what's your SQL resources

                                Brent Ozar.

                                1 Reply Last reply
                                0
                                • M Maximilien

                                  So, what's your SQL resources for beginners and related to JOINs ? I'm kind of stuck on request that should use JOIN and can't figure out how to make it work. I somewhat understand how it works, but there's something missing in my understanding of the universe. Thanks.

                                  CI/CD = Continuous Impediment/Continuous Despair

                                  S Offline
                                  S Offline
                                  StatementTerminator
                                  wrote on last edited by
                                  #16

                                  If you're familiar with how joins work but are having problems figuring out how to use them in a particular query, it might be good to back up and look at the structure of the database you're working with. For instance, do you even have a good key to join on? A poor DB structure with a lack of normalization can make joins difficult or even impossible. If that's the problem, one way around it is to throw the data into temp tables with the correct structure you need for the joins and query against that. Speaking of which, in a addition to learning about SQL it's also a very good idea to learn the fundamentals of database design if you haven't already. Knowing about things like normalization, keys, and indexing really helps when writing SQL.

                                  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