SQL Tricks | How to find value in multiple columns ?

preview_player
Показать описание
In this tutorial, we write a SQL Query to find a value in multiple columns.

STRING_AGG tutorial

How to concatenate rows into column for older versions of SQL Server?

Dynamic SQL tutorial

Practice dataset and SQL code available here -

How to install SQL Server for practice?

Check out the complete list of SQL Query Interview Questions -

Best Data Science / Analytics / SQL courses
Learn SQL Basics for Data Science Specialization

Beginners to Python Programming

Data Science and Business Analytics with Python

IBM Data Science Professional Certificate

Data Science Fundamentals with Python and SQL Specialization

Python for Everybody Specialization

Google Data Analytics Professional Certificate

Coursera Plus - Data Science Career Skills

Please do not forget to like, subscribe and share.

For enrolling and enquiries, please contact us at
Рекомендации по теме
Комментарии
Автор

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

shekhark
Автор

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

smcgpra
Автор

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

sivachandar
Автор

Can I use it for NULL in each of the columns

samarif
Автор

Great video ma'am

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

avi
Автор

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

AnandKumar-dcbf
Автор

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

nakuldeep
Автор

Please share more SQL tips and tricks.

kristyowens
Автор

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

abdullahquhtani
Автор

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

maheshp
Автор

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

siddheshamrutkar
Автор

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.

nikolaybaranov