Solving SQL Interview Queries | Tricky SQL Interview Queries

Solving SQL Interview Queries | Tricky SQL Interview Queries

techTFQ

2 года назад

273,219 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

sanal kumar
sanal kumar - 12.11.2023 11:41

Hi All, I am the beginner in the IT field. I used the same comments but i am not getting the answer properly. could you please help me.
select case when translation is null
then comment
else translation
end as output
from comments_and_translation;
I am using MY SQL Work Bench for learning purpose.

Ответить
Madhu Kommana
Madhu Kommana - 08.11.2023 06:07

Thanks a ton a detailed explanation

Ответить
Nishanth
Nishanth - 26.10.2023 14:36

Awesome Man!

Ответить
coco cnk
coco cnk - 16.10.2023 15:07

Thanks TFQ the last question was everything, I was blocked on how to remove mirror effect records from my query.

Ответить
Rajeev kumar
Rajeev kumar - 07.10.2023 15:34

Hi ,
Can you please suggest any to learn from? I have started learning SQL.
Thanks!

Ответить
Nisha Pandit
Nisha Pandit - 06.10.2023 12:14

Wonderful expiations, especially the last question has a newer nuance..

Ответить
mark filmore
mark filmore - 05.10.2023 07:39

thanks teacher, im learning alot your a great teacher

Ответить
Abuzaid Sweiti
Abuzaid Sweiti - 30.09.2023 19:56

Slow down little bit,Why you are running with your speech ?

Ответить
theweekendfoodbites
theweekendfoodbites - 28.09.2023 09:08

For the 3rd question, we can simply use cartesian join too..for playing twice

Ответить
Aryaka Agnihotri
Aryaka Agnihotri - 26.09.2023 17:27

third one can solve by using simple self join

for 2 match with each team --
select t1.team_code team1 , t2.team_code team2 from teams t1 ,
teams t2
where t1.team_code <> t2.team_code ;

for one match with each team --
select t1.team_code team1 , t2.team_code team2 from teams t1 ,
teams t2
where t1.team_code > t2.team_code ;

Ответить
Ekta Shah
Ekta Shah - 20.09.2023 19:30

query 2: without joins
select id , case when id = 3 then 'new in source' else 'mismatch' end as output from source where id in(3,4)
union
select id ,'new in target' as output from target where id in (5) OR

select id , decode (id ,3,'new in source',4,'mismatch') as output from source where id in(3,4)
union
select id ,'new in target' as output from target where id in (5);

Ответить
Rajkumar Rajan
Rajkumar Rajan - 18.09.2023 14:47

Brilliant !!!

Ответить
Ben Long
Ben Long - 18.09.2023 03:09

This video was really interesting. Your explanations are great! Thank you

Ответить
sunil pardeshi
sunil pardeshi - 15.09.2023 16:18

Hi
In my results
Out put is like
3,4,5
But ur output 3,5,4
I'M using ssms server or other things

Ответить
kiran chand
kiran chand - 14.09.2023 11:09

hi bro,

can you please help me to get resolve this task.
Sales table:
------------+------------+-------------+
| sale_date | fruit | sold_num |
+------------+------------+-------------+
| 2020-05-01 | apples | 10 |
| 2020-05-01 | oranges | 8 |
| 2020-05-02 | apples | 15 |
| 2020-05-02 | oranges | 15 |
| 2020-05-03 | apples | 20 |
| 2020-05-03 | oranges | 0 |
| 2020-05-04 | apples | 15 |
| 2020-05-04 | oranges | 16 |
+------------+------------+-------------+

Write an SQL query to report the difference between number of apples and oranges sold each day.

Ответить
shruti singh 308
shruti singh 308 - 06.09.2023 17:29

sir i have already emailed you regarding my query please try to respond as soon as possible, Thankyou

Ответить
Lancelot DSouza
Lancelot DSouza - 25.08.2023 19:42

Please solve questions on sub query and pivot

Ответить
Joshil Thummer
Joshil Thummer - 22.08.2023 21:25

Thanks!

Ответить
VENKATESWARA RAO Devisetti
VENKATESWARA RAO Devisetti - 20.08.2023 09:28

Nice question and answers
However the third question can be solved without rownumber()
as the < can be directly applied on team code

Ответить