Hands on SQL Query to compare the data between Tables/Views & Schema Comparison - Practical queries

Поделиться
HTML-код
  • Опубликовано: 16 окт 2024
  • Hello everyone,
    This video details how to compare the data between 2 tables covering Schema checks , Counts and data comparison row by row in practical way
    Please Like, Share and Subscribe our channel
    Thanks
    Suri Sessions

Комментарии • 5

  • @khangtuy6445
    @khangtuy6445 Год назад +2

    I have been searching for the most efficient way to find differences between two tables. I saw some people use EXCEPT/MINUS. Some used UNION ALL and GROUP BY like you. Other used LEFT JOIN. Can you explain why your approach is more efficient and maybe point me to some resources that could prove that? Awesome video. Thank you very much.

  • @meerdadapeer1491
    @meerdadapeer1491 Год назад

    Helpful

  • @dreamhousepune2051
    @dreamhousepune2051 6 месяцев назад

    Hello sir, if schema multiple but how to findout table information dd?

  • @hemantbhange374
    @hemantbhange374 Год назад +1

    Why do we use the min function? Didn't understand can you please explain

    • @khangtuy6445
      @khangtuy6445 Год назад +2

      Because all the other column(s) not specified in the GROUP BY clause must be used in aggregate function(s) if you want to include them in the SELECT clause. In his example, he used all columns except Tab in his GROUP BY. So if he wants to include Tab in the SELECT clause, he needs to put it in some aggregate function. The choice of which aggregate function to use in this case is up to you. Since Tab has only two possible values ('Customers' or 'Customers2'), using min(Tab) will display 'Customers' whenever there is a match b/t the two tables. But since he set the HAVING COUNT(*)=1, these match rows will not be displayed anyway. Therefore, in this case, you can use whatever aggregate function you want.