SQL Tricks | How to find value in multiple columns ?

Поделиться
HTML-код
  • Опубликовано: 19 дек 2022
  • In this tutorial, we write a SQL Query to find a value in multiple columns.
    STRING_AGG tutorial
    • SQL Query - Convert da...
    How to concatenate rows into column for older versions of SQL Server?
    • SQL Query | How to con...
    Dynamic SQL tutorial
    • SQL | Create and Execu...
    Practice dataset and SQL code available here -
    know-star.blogspot.com/2022/1...
    How to install SQL Server for practice?
    • How to install SQL Ser...
    Check out the complete list of SQL Query Interview Questions -
    • SQL Query Interview Qu...
    Best Data Science / Analytics / SQL courses
    Learn SQL Basics for Data Science Specialization
    imp.i384100.net/qnXYk5
    Beginners to Python Programming
    skillshare.eqcm.net/GjMakm
    Data Science and Business Analytics with Python
    skillshare.eqcm.net/JrM1Aq
    IBM Data Science Professional Certificate
    imp.i384100.net/LPQvg3
    Data Science Fundamentals with Python and SQL Specialization
    imp.i384100.net/mgVYre
    Python for Everybody Specialization
    imp.i384100.net/DVz7Aj
    Google Data Analytics Professional Certificate
    imp.i384100.net/OR37oQ
    Coursera Plus - Data Science Career Skills
    imp.i384100.net/c/3299742/132...
    Please do not forget to like, subscribe and share.
    For enrolling and enquiries, please contact us at
    Website - knowstar.org/
    Instagram - / learn.knowstar
    Facebook - / knowstartrainings
    Linkedin - www.linkedin.com/company/know...
    Email - learn@knowstar.org

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

  • @shekhark1139
    @shekhark1139 10 месяцев назад

    Oh my goodness, its very very helpful... Many thanks to you.

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

    As per your example from Tbl1, If I want to find demo in col1, col2, col2, col4, col5 ? Pls reply

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

    Hi ,
    I want to find max date for each tables present in each schema how to write it dynamically

  • @gustavoadolfogomezacevedo3905
    @gustavoadolfogomezacevedo3905 9 месяцев назад +1

    Thanks!

    • @LearnatKnowstar
      @LearnatKnowstar  9 месяцев назад

      Thank you so much for your support 🙏

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

    I learnt lot from this channel, good explanation ma'am

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

    Thanks for sharing

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

    Great video ma'am
    One question
    where 'cancelled' in (col1,col2) is available just in SQL server or is it universal?

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

      Thank you. Might not work in all databases.

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

      I tried to perform it in pgadming and worked.

  • @samarif6467
    @samarif6467 2 месяца назад

    Can I use it for NULL in each of the columns

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

    Excellent and will be great 💪🏼 if there is a way to loop all tables in a specific Database 🤔😏

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

      Thank you. May need to write a stored procedure to loop through all table names.

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

      You can use EXEC sp_MSforeachtable, example for records count,EXEC sp_MSforeachtable 'SELECT ''?'' TableName, Count(1) NumRecords FROM ?'

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

    Please share more SQL tips and tricks.

  • @AnandKumar-dc2bf
    @AnandKumar-dc2bf Год назад +1

    Hi Mam!
    Can you do some mesium/ hard videos on sql leet code questions please...

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

      Sure. We are planning something soon. Stay tuned 👍

  • @rk-ej9ep
    @rk-ej9ep Год назад

    Nice ma'am..👍

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

    Nice Video.. But what if want to find only the Cancelled then in that case only two columns should appear..

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

      It will output the whole record because we are performing a Select *.

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

    How to make this work in oracle

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

      If this does not work in oracle, then an or in where clause can always be used to compare each and every column value.

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

    Select gold as Player,count(1) from events k
    where not Exists (Select * from events p where k.gold=p.silver)
    and not exists (Select * from events C where k.gold=C.BRONZE)
    group by GOLD

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

    Yes, this script is functional. But:
    1. Dynamic queries are evil. Supporting such code is very time consuming
    2. Code is vendor dependent and not portable
    3. I can hardly imagine a situation where the table name is known in the database, but the column names are unknown or they can change arbitrarily. The above example shows that the base is not even in second normal form. This is not a base, but complete chaos. Instead of writing queries to this database, I would rather quit.

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

      Thank you for your comments. They are always insightful and knowledgeable.
      Yes, I agree this is not the best example of writing a code and should be used just as a quick trick for simpler requirements.