Top 10 SQL Interview Queries | Popular SQL Queries for SQL Interview

Top 10 SQL Interview Queries | Popular SQL Queries for SQL Interview

techTFQ

5 месяцев назад

173,685 Просмотров

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


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

@ramjigupta174
@ramjigupta174 - 30.11.2023 17:59

Hi @techTFQ! In problem 10, Why are we not considering a case where order status is submitted and created for same user (3rd statement in the union)??

Ответить
@muralibaddela9201
@muralibaddela9201 - 29.11.2023 22:50

Excellent questions Toufiq , covers quite a bit of SQL innards

Ответить
@mmmuneer707
@mmmuneer707 - 29.11.2023 18:48

Hi Toufiq!!
All question are so interesting. I just found few things which effects the query.
Q1) The table has only 2 duplicate rows, assume if table has 3 duplicate rows then sol 1 and sol 2 won't work as it will select MAX() and MIN() model_id. Here most accurate sol is sol 3 using ROW_NUMBER().
Q7) In this to write negative amount as (amount$), || won't work in MYSQL instead CONCAT() can be used.

Ответить
@vinayakyerekar762
@vinayakyerekar762 - 29.11.2023 14:28

Please Explain query No. 6 in detail.

Ответить
@shruthigowda5985
@shruthigowda5985 - 29.11.2023 06:31

Pls make query tuning videos..

Ответить
@user-ho9fd2ez5z
@user-ho9fd2ez5z - 28.11.2023 11:25

Hi, Can cross join be used to solve query no 6 (Part 1)?

SELECT T1.team_code, T2.team_code FROM teams T1 CROSS JOIN teams T2
ON T1.team_code=T2.team_code

Ответить
@sapatil8999
@sapatil8999 - 28.11.2023 03:24

Query 4 -
select t2.source,t1.destination,t1.distance from src_dest_distance t1 left join src_dest_distance t2 on t1.source = t2.destination where t2.source IS NOT NULL

Ответить
@vijaykumar-vp7mx
@vijaykumar-vp7mx - 27.11.2023 23:59

Can you make videos on sql developer
Road map to be a sql developer please

Ответить
@shekhark1139
@shekhark1139 - 27.11.2023 21:32

Please make a video about data execution in sql server, how to identify bad or good ( efficient or inefficient queries) , how the cost of query in percent matters

Ответить
@rehanashaik5497
@rehanashaik5497 - 27.11.2023 20:24

Hi tfq plz can u explain slowly i cannot catch you

Ответить
@crownaradhya
@crownaradhya - 27.11.2023 20:20

Thank you , bahut sikhne ko milta he , aur questions late raho 👌👍

Ответить
@mitul2312
@mitul2312 - 27.11.2023 13:04

Query 2 can also be written as, a small change
Select *,
max(salary) over (partition by dept order by salary desc ) as highest_salary,
min(salary) over (partition by dept order by salary) as lowest_salary
from employee;

Ответить
@followurdream123
@followurdream123 - 26.11.2023 22:06

in your vlog employee table creation script is not working for 2019 version ,fyi

Ответить
@kshitijadeshmukh6800
@kshitijadeshmukh6800 - 26.11.2023 09:48

Best video, I have faced a few of these exact questions from this video in my interviews. Thank you @techTFQ

Ответить
@udhaybhaskarbellamkonda1678
@udhaybhaskarbellamkonda1678 - 25.11.2023 19:46

Hi Taufiq When will you start Python Bootcamp let me know pls

Ответить
@user-xe9zi9yw2e
@user-xe9zi9yw2e - 25.11.2023 09:09

Hi, I've been working as a programmer for about two years in a financial company. However, I still struggle with understanding complex queries. While I get the few chance to write queries at work, there are instances where I need to read long queries, sometimes exceeding 500 sentences, due to unexpected circumstances.

I genuinely make an effort to read and comprehend them, but when multiple challenging grammar concepts like outer joins and subqueries are used together, I find it difficult to grasp. In this situation, what should I focus on learning to improve my ability to read complex and lengthy query sentences? I really want to enhance my skills in this area.

Ответить
@tonysun203
@tonysun203 - 25.11.2023 07:08

Hi Toufiq. Thanks a lot for providing so many useful examples on solving SQL. I have been learning quite a lot from your videos and your SQL / python courses. Really appreciate for these courses and videos that you have done for us. Also, thanks for introducing the learnSQL website to us. I have registered for the life time eLearning also. Also, you are the best teacher I've met on learning SQL. Hope you continue to make these quality and useful video for us. Keep going brother 👍
From Tony

Ответить
@reshmaammu4726
@reshmaammu4726 - 24.11.2023 20:14

1) with cte AS(select *, dense_rank() over(order by model_name, color, brand) from cars),
cte2 as
(select distinct model_name, color, brand from cte)
select distinct min(a.model_id) over(partition by a.model_name, a.color, a.brand), b.model_name, b.color, b.brand from cte a right join cte2 b
on a.model_name=b.model_name and a.color=b.color and a.brand=b.brand
order by model_id
2)with cte AS
(select *, dense_rank() over(partition by dept order by salary desc, name) as ranks, max(salary) over(partition by dept) as highest, min(salary) over(partition by dept)
as lowest from employee)
select id, name, dept, salary, highest, lowest from cte
3)with cte AS(select *, lag(cumulative_distance) over(partition by cars) as distance from car_travels),
cte2 as
(select *, (cumulative_distance-distance) as diff from cte)
select cars, days, cumulative_distance, case when diff is null then cumulative_distance else diff
end as distance_travelled
from cte2
4)with cte AS
(SELECT
min(SOURCE, DESTINATION) AS MinValue,
max(SOURCE, DESTINATION) AS MaxValue,
distance
FROM src_dest_distance)
select DISTINCT * from cte
5)WITH RECURSIVE FruitRecursion AS (
SELECT id, item_name, total_count
FROM travel_items

UNION ALL

SELECT id, item_name, total_count - 1
FROM FruitRecursion
WHERE total_count > 1
)

SELECT id, item_name
FROM FruitRecursion
order by item_name
6)a)select distinct a.team_name as A1, b.team_name as B1
from teams a CROSS JOIN teams b
where a.team_name<b.team_name


b)select distinct a.team_name as A1, b.team_name as B1
from teams a CROSS JOIN teams b
where a.team_name!=b.team_name

Ответить
@maghy_kethychannel
@maghy_kethychannel - 24.11.2023 07:48

hi toufiq plz do more videos on data analytics and how to do more analytical work with excel.plz plz

Ответить
@srinubathina7191
@srinubathina7191 - 23.11.2023 21:36

Thank you Amazing content

Ответить
@tanmayhadke9161
@tanmayhadke9161 - 23.11.2023 20:15

Can I know which IDE do you use for SQL?

Ответить
@saivaibhav3331
@saivaibhav3331 - 23.11.2023 19:16

For question 4 we can do like this also

with cte as (
select *, row_number() over(order by (select null)) as rn from src_dest_distance)
select source,destination,distance from cte
where rn%2<>0

Ответить
@luwammhreteab2606
@luwammhreteab2606 - 23.11.2023 12:17

is that free coures or with paying

Ответить
@mohammedshahil4898
@mohammedshahil4898 - 23.11.2023 10:52

Another quality content from Techtfq👌👌👏 Keep going brother🙌

Ответить
@inbox.sanatan
@inbox.sanatan - 23.11.2023 09:28

Haven't seen any channel creating this gold level across platform

Ответить
@aumprakashdehury
@aumprakashdehury - 23.11.2023 08:00

Thank you Thoufiq, Really leaned a lot from you.

Ответить
@UiPathGuide
@UiPathGuide - 23.11.2023 04:29

Awesome content as usual!

Ответить
@ArunKumar-bp5lo
@ArunKumar-bp5lo - 22.11.2023 23:21

the perfect video i never know i needed

Ответить
@shashankmishra7437
@shashankmishra7437 - 22.11.2023 22:49

Solved 0/10 queries... Its bit hard for beginner like me to learn sql

Ответить
@bharatsharma5758
@bharatsharma5758 - 22.11.2023 21:27

for query 4 u forgot order by clause

with cte as (
SELECT *, ROW_NUMBER() OVER(order by source) AS RN
FROM src_dest_distance)
select t1.source,t1.destination,t1.distance, t1.RN
from cte t1
join cte t2
on t1.source = t2.destination
and t1.destination = t2.source
and t1.RN < t2.RN

Ответить
@sevsxes
@sevsxes - 22.11.2023 19:49

Thank you very much for such detailed info

Ответить
@fathimafarahna2633
@fathimafarahna2633 - 22.11.2023 19:40

Always a privilege for learners to get your video … You are doing a good service 👌God bless your efforts

Ответить
@user-lh3dy8jo3d
@user-lh3dy8jo3d - 22.11.2023 18:50

In the car duplicate question, you haven't mention color but if the color is different then it won't be a duplicate one right..then is it right to delete the record without considering color?
Please clarify

Ответить
@Malathi_Steps
@Malathi_Steps - 22.11.2023 18:49

Hi Toufiq! I have gone through SQL course from the beginning to brush up my skills and all the concepts. In the recent interview, I cleared all the technical rounds and I got placed last week with a good hike. Your videos and your teaching helped me a lot.! I am really Happy! Please keep going. God bless you!

Ответить
@leochen4393
@leochen4393 - 22.11.2023 17:57

Is it for Oracle SQL?

Ответить
@Rahelgodi
@Rahelgodi - 22.11.2023 17:50

​Hi taufiq! Can you make logical interview questions more?

Ответить
@umangbhatnagar1415
@umangbhatnagar1415 - 22.11.2023 17:47

Really Really Awesome !!

Ответить
@konetinaveenbabu3972
@konetinaveenbabu3972 - 22.11.2023 17:43

Sir i want sql classes can you please provide me

Ответить
@akramhusain5768
@akramhusain5768 - 22.11.2023 17:33

Do you have any sql course
I want to learn sql to you.

Ответить
@da_vinci5100
@da_vinci5100 - 22.11.2023 17:23

Hey Toufeeq!

I have been trying buy your SQL recording from your website but it doesn't allow me to move forward from cart.

Can you fix this?

Ответить
@Batira583
@Batira583 - 22.11.2023 17:22

Always a pleasure to watch your videos Thofik. I m learning a lot from you .

Ответить
@akkys97
@akkys97 - 22.11.2023 17:15

Sir I mailed you but didn't get any response from your side

Ответить
@m.s.k5300
@m.s.k5300 - 22.11.2023 17:13

Nice thofiq

Ответить
@mounikanillapala4851
@mounikanillapala4851 - 22.11.2023 17:09

Hi ☺️

Ответить