Querying Multiple Tables with SQL

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024
  • Demonstration of how to query two or more tables with SQL Server.

ความคิดเห็น • 68

  • @BudGooey
    @BudGooey 5 ปีที่แล้ว +11

    This is the first link out of about twenty different pages that actually helped me solve my issue.

    • @Milltao3
      @Milltao3 3 ปีที่แล้ว

      Can you select the primary id itself?

  • @dzunisanithemba99
    @dzunisanithemba99 หลายเดือนก่อน +1

    Thank you for the simplicity.

  • @sanjeevKumar-eg6hp
    @sanjeevKumar-eg6hp 3 ปีที่แล้ว +3

    Thank you sir for wonderful explanation, It was very clear and anyone who watches the video can
    easily understand the concept
    It helped solve one of major obstacle in sql

  • @115advitiya
    @115advitiya 3 ปีที่แล้ว +1

    You really saved my behind with this video

  • @oatie4262
    @oatie4262 3 ปีที่แล้ว +3

    Can't believe this only has 752 views when the content is so good. Thank you so much, this is waaaay clearer than what I was learning in school! Sharing it with my classmates!

  • @i_declare_bankruptcy686
    @i_declare_bankruptcy686 3 ปีที่แล้ว +4

    I think learning stuff on TH-cam must be considered formal learning and I should be able to add that I know something I learnt from a TH-cam tutorial on my resume.👌😂

  • @anujdhumal9114
    @anujdhumal9114 4 ปีที่แล้ว +1

    thank you very much for this video, i was stuck at one query ,and searched many videos and finally find accurate concept.

  • @MXVMichael
    @MXVMichael 2 ปีที่แล้ว +1

    I’m going to give to a try when I get to work 👍🏾👍🏾👍🏾Thanks buddy!

  • @ayanshaikh4993
    @ayanshaikh4993 ปีที่แล้ว +1

    Thanks Larry

  • @harinath8938
    @harinath8938 2 ปีที่แล้ว +1

    good explanation very useful, but can you explain same as well as with 3 or more tables

    • @LarryDomine
      @LarryDomine  2 ปีที่แล้ว

      Glad this video helped. The same sequence can be applied to more tables in a 'stacking' configuration. The key is to remember that you are taking data from a table to create its own virtual table that is used by another join statement. If there are a lot of joins to stacked, it may be due to a poor database design. Here is a link that may help you understand this process: codingstatus.com/sql-join-4-tables/

  • @babakiani
    @babakiani 3 ปีที่แล้ว +1

    Thank you Larry! This content was really useful!

  • @kienolaliwatari9610
    @kienolaliwatari9610 2 ปีที่แล้ว +1

    Thank you so much for this, it was really informative and helpful

  • @EuanMcG
    @EuanMcG 3 ปีที่แล้ว +1

    You are my hero

  • @AbinashMishra
    @AbinashMishra 3 ปีที่แล้ว

    awesome keep going larry we need you, searched everywhere got a good explanation here. Eggactly what I need \m/ a 2016 video helping in 2021

    • @Alfredo5883
      @Alfredo5883 3 ปีที่แล้ว

      Same here. People should do more tutorials on DML, bcos thats the core of having to learn sql

  • @reghuk
    @reghuk 4 ปีที่แล้ว +1

    Thank you man, you're a Gentleman and a scholar!

  • @readysetsuccess
    @readysetsuccess 2 ปีที่แล้ว

    Just in time learning. Thanks!

  • @jamarwilson3592
    @jamarwilson3592 2 ปีที่แล้ว +1

    Can someone help me? at 5:25 he creates a - function next to select that corresponds to the block of code. How do I incorporate that? At the moment I can only answer 1 query.

    • @LarryDomine
      @LarryDomine  2 ปีที่แล้ว

      At the point in the video more SQL statements are being used, not a function. Here is another video with an overview of SQL Statements th-cam.com/video/jWX78wsJMK0/w-d-xo.html

  • @julianmac
    @julianmac 3 ปีที่แล้ว +1

    Thanks, actually helped me so much.

  • @fitsumarja5865
    @fitsumarja5865 2 ปีที่แล้ว +1

    thanks for your commitment and i would like to ask a question. which is when i execute exact same command(esp. the first one) it only fetches the column names only.

    • @LarryDomine
      @LarryDomine  2 ปีที่แล้ว

      Data has to be in the table to be able to obtain anything more than the column names. Run some INSERT INTO statements to insert data into the tables.

  • @wastedart1794
    @wastedart1794 3 ปีที่แล้ว +1

    Thx you Larry this is definetly getting me in the rigte direction, but im trying to join for tabels its very hard, to get them connected or maybe i just need to improve myself, thx you anyway :)

    • @LarryDomine
      @LarryDomine  3 ปีที่แล้ว +1

      It may not be you. Writing good SQL statements is dependent upon having a well designed database. The better the design the easier it is to retrieve the data. Checkout my video on using JOIN statements: th-cam.com/video/d3e0TtPswN0/w-d-xo.html

    • @wastedart1794
      @wastedart1794 3 ปีที่แล้ว

      @@LarryDomine i will I agree I had to rework my dB and It fixed it all 😁 so now I am hammered, the problem got solved

  • @vamsireddy5051
    @vamsireddy5051 5 ปีที่แล้ว +1

    What about performance if you are using where conditions and join conditions?
    We know joins performance is good compare to where condition.
    Please let us clarify.

  • @januarekosubagio5525
    @januarekosubagio5525 7 ปีที่แล้ว +1

    in my case, I have 12 tables and I don't know how to join these tables.
    it looks simple but it is also complicated. I hope you can help me with this, anyway you did a great job keep it up sir !
    thanks

    • @reeceytaylor
      @reeceytaylor 7 ปีที่แล้ว

      you have to select your data and then when using the FROM query you type in the tables like this: FROM table 1, table 2, table 3 etc.

  • @yeyeTF2
    @yeyeTF2 4 ปีที่แล้ว +5

    starts at 4:05

  • @Myself_9037
    @Myself_9037 ปีที่แล้ว +1

    I have a doubt. I have table with two fields, one field is array in table 1
    uID | Contact
    2 | 1221,1223
    3 | 1123
    Now value of 1221 and 1223 are in table Two. I want a query to join table 1 and table 2 using array of field2

    • @LarryDomine
      @LarryDomine  ปีที่แล้ว

      Not sure what it is you need to do. A JOIN is based upon joining tables based upon a the data in a common field (normally a primary key and foreign key). This creates a 'virtual table'. separate

    • @LarryDomine
      @LarryDomine  ปีที่แล้ว

      Here is a link with more information: dataschool.com/how-to-teach-people-sql/sql-join-types-explained-visually/

  • @ecxlv
    @ecxlv 5 ปีที่แล้ว

    brilliantly explained sir

  • @drdoughnut38
    @drdoughnut38 5 ปีที่แล้ว +1

    You're a beast this is exactly what I needed!!

  • @sltech837
    @sltech837 3 ปีที่แล้ว

    Good video

  • @jansen6583
    @jansen6583 5 ปีที่แล้ว

    Thanks man I was wondering why my query was taking so long.

  • @rodrigoalejandrogallardoga5812
    @rodrigoalejandrogallardoga5812 5 ปีที่แล้ว

    THANK YOU, very helpful and nicely explained.

  • @smurfmoniquii
    @smurfmoniquii 4 ปีที่แล้ว

    You are a lifesaver thanky ou!!!!

  • @fahadm3444
    @fahadm3444 6 ปีที่แล้ว

    I am trying to pull data from three tables but running into a relation issues.
    Table1: Customer Table.
    Table 2: Invoice Table
    Table 3: Invoice Detail Table
    On table 1 the customer number column is "BPCNUM_0"
    On Table 2: The customer number column is "BPR_0"
    On Table 3: The customer number column is "BPCINV_0"
    Any idea how I can connect them to pull the data?

  • @soldadopreciso
    @soldadopreciso 5 ปีที่แล้ว +2

    how enable ssms to see two result tables in the same windows

    • @craigbaggley6047
      @craigbaggley6047 5 ปีที่แล้ว

      1. Select * from
      2. Select * from
      Highlight both and execute.

  • @arslanali1346
    @arslanali1346 3 ปีที่แล้ว +1

    Please I have a few questions which I need help with.
    For these I have the tables ready but I am not sure if my queries are right. All the tables that I need are in section 1 which are done and completed. But for the queries from these tables are so confusing. I want to show you what I have done could you please show me if they are right . Please reply me if you can help me. I will send you all the queries I have done in the morning if you are ready to help me. Thank you
    God bless you.
    Kind regards
    Arslan

    • @LarryDomine
      @LarryDomine  3 ปีที่แล้ว +2

      The demonstration in the video is for simple SELECT statements for use with mulitiple tables. When writing a query (SELECT statement) always work in reverse. Start with what data you would like to see as the result of the data. Then identify what table(s) this data will come from. This works for most queries in a well defined database. However, evaluate if this data and the tables they are in will need other types of Joins, Unions, or Sub Select statements from which to take the data from. Here is a link that I found that may help provide further information: www.essentialsql.com/a-case-study-on-how-to-use-joins-subqueries-and-unions-to-combine-data-in-sql/

    • @osoriomatucurane9511
      @osoriomatucurane9511 หลายเดือนก่อน

      Awesome tutorial, crystal clear and concise. Thank you for the tutorial, specially for the trick to identify the matching column keys from the explorer windows and for the link to EssentialSQL with an interesting query. Kris Wenzil is a phenomenal SQL instructor

  • @TheSQLGuy
    @TheSQLGuy 5 ปีที่แล้ว

    Great video! Really informative

  • @pratibhalohiya9874
    @pratibhalohiya9874 2 ปีที่แล้ว

    i have a ques that we create one database and in one database we can create only one table . how ur database productorder included soo many tables ...???

    • @LarryDomine
      @LarryDomine  2 ปีที่แล้ว

      One possible reason is you may not have permission to create tables in the database management system you are using. Check that out.
      If you have authority to create tables, you can use the tools in the database management system software, or you can write CREATE statements.
      docs.microsoft.com/en-us/sql/relational-databases/tables/create-tables-database-engine?view=sql-server-ver15

  • @reeceytaylor
    @reeceytaylor 7 ปีที่แล้ว +2

    thanks, this helped me a lot

  • @balajir4448
    @balajir4448 5 ปีที่แล้ว +1

    Thank you, very useful

  • @jbhargav7181
    @jbhargav7181 2 ปีที่แล้ว

    Can we use IN operator by using two tables

  • @KumarAnalytic
    @KumarAnalytic 5 ปีที่แล้ว

    Thanks sir.good explained

  • @pulkitlanjewar8454
    @pulkitlanjewar8454 2 ปีที่แล้ว

    Description
    There are 2 datasets present in the file. Data 1 and Data 2
    The primary key for both data1 and data2 is Order Id + Product ID combination (i.e. the individual datasets do not have any duplicate on this combination)
    Provide solution and approach for the following:
    How to identify the Records (Order ID + Product ID combination) present in data1 but missing in data2 (Specify the number of records missing in your answer)
    How to identify the Records (Order ID + Product ID combination) missing in data1 but present in data2 (Specify the number of records missing in your answer)
    Find the Sum of the total Qty of Records missing in data1 but present in data2
    Find the total number of unique records (Order ID + Product ID combination) present in the combined dataset of data1 and data2
    Allowed Tools SQL

  • @tonystites2134
    @tonystites2134 6 ปีที่แล้ว

    how do you create a new table from that I tried Create Table tablename AS but it did not work

  • @surabhisunil21
    @surabhisunil21 4 ปีที่แล้ว

    is it possible to give a user defined column in jdbc?

    • @LarryDomine
      @LarryDomine  4 ปีที่แล้ว

      Kind of....It is all about what data is needed in the relational database.
      A 'user defined column' is often a column in a relational database table where the user can enter any data they would like, as long it is of the correct datatype for the column.
      In a relational database management system, the importance is to collect data that can be queried to provide information. This then relates to collecting facts, such as name, address, income, favorite color, etc.
      There are times when data associated with an entity may not be easily defined, such as comments, opinions, analysis, etc. The data to be input to this column would not be easily defined answers are what can be considered a 'user defined column'.

  • @umangternate
    @umangternate 3 ปีที่แล้ว

    Can this method be applied to update and delete data from multiple tables?

    • @LarryDomine
      @LarryDomine  3 ปีที่แล้ว +1

      Kind of.... Keep in mind that UPDATE and DELETE have their own syntax requirements. Here is an example I found from someone else to consider. stackoverflow.com/questions/2044467/how-to-update-two-tables-in-one-statement-in-sql-server-2005

  • @nileshmandlik9662
    @nileshmandlik9662 3 ปีที่แล้ว

    more videos like this

  • @cd78
    @cd78 6 ปีที่แล้ว

    Larry do you still have visibility over these comments

  • @danielflamebrown5426
    @danielflamebrown5426 3 ปีที่แล้ว

    Thank you...

  • @gamer4lyfez325
    @gamer4lyfez325 5 ปีที่แล้ว

    why would you force 1080p ??

  • @jaysanghavi8248
    @jaysanghavi8248 5 ปีที่แล้ว

    Tysm☺️

  • @itreportcambodia8283
    @itreportcambodia8283 3 ปีที่แล้ว

    hello b