How to Solve SQL Interview Problems | Learn SQL Part 2/n

  Рет қаралды 36,049

Sundas Khalid

Sundas Khalid

Күн бұрын

Пікірлер: 87
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Do you know SQL? How would you define your level of expertise in SQL?
@ShamimKhan.17
@ShamimKhan.17 2 жыл бұрын
SQL " Structured Query Language" it used for storing and managing data in relational DBMS.
@omkarsatapathy8209
@omkarsatapathy8209 2 жыл бұрын
1 🌟
@hebashakeel7161
@hebashakeel7161 2 жыл бұрын
Yes. Just medium level
@chacmool2581
@chacmool2581 2 жыл бұрын
Yes, I know a bit of SQL. I've actually taken two graded courses at UCSD so I reckon my level is 'introductory intermediate'. I am familiar not only with the actual data query language, but also with the system management (user accounts, user priviledges, etc.), transaction control (rollsbacks and all jazz) and database management language and concepts. Truth be told, though, I much prefer to manipulate and clean data with Python pandas or the R Tidyverse. There's even a way of querying SQL dabatases from within R onto an R dataframe with the RODBC package and onto a Python panda. The other PITA part of SQL is the ingestion/importing of non SQL database data whereas R and Python make it much, much easier. SQL is downright archaic in that regard. For me, SQL is a tool of necessity, not a tool of choice, a tool for data retrieval and storage rather than a tool for data manipulation and analysis. Required 'Data Science' skill for sure, but not the sexiest or most engaging, IMO.
@sachintambeshwar9712
@sachintambeshwar9712 2 жыл бұрын
Make us pro in SQL query.
@heyrobined
@heyrobined 2 жыл бұрын
1. select salary as SecondHighestSalary from employee e order by SecondHighestSalary desc limit 1 offset 1 2. SELECT score, DENSE_RANK() OVER (order BY score DESC) as 'rank' FROM Scores
@tuannguyen4802
@tuannguyen4802 2 жыл бұрын
Hi. In the first problem, your solution will just work if you press 'Run Code'. When you press 'Submit', it won't work in all situations. Anyway I love your contents.
@shireendash24
@shireendash24 2 жыл бұрын
At 2:10, "an" has been used because they have considered the eS-Q-L pronunciation for SQL!
@omkarsatapathy8209
@omkarsatapathy8209 2 жыл бұрын
Awesome ! I have been trying to learn SQL since months. Even i purchased a course from Coursera. but asa the course begins i fell asleep. 🤣 just so boring in front of python. looking forward to have some intrest and motivation from you video. OMKAR ...
@anandvyavahare2031
@anandvyavahare2031 2 жыл бұрын
In first problem you can not use row_number(), but instead you need to use dense_rank(). Row_number will not consider the ties, if present. Even rank() will not work as if the highest salary is tied then the rank will skip the 2nd highest. So you need to use dense_rank()
@1234sagarsingh20
@1234sagarsingh20 2 жыл бұрын
Yep that's correct. Seeing her using row_number just gave me chills and shows she herself need to work on her solutioning
@wazeer23
@wazeer23 2 жыл бұрын
I think these videos are extremely helpful for people prepping for Data related roles, because its great to hear about how a SQL expert processes and understands the problem! Especially beneficial using the Leetcode examples. This could be a really cool series you end up doing!
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Thanks, Wazeer! I appreciate the feedback. Excited to do more of these :)
@akshitsinghal8590
@akshitsinghal8590 2 жыл бұрын
Solution of First problem is not correct Mam, because you didn't consider the second part i.e. "null" if there is no second value.
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Yes you are right. I missed that
@SeattleDataGuy
@SeattleDataGuy 2 жыл бұрын
Another great video! Thanks Sundas. Of course, its always a fun moment in an interview when an interviewer is like "Can you do it without a window function" 😢😂
@SundasKhalid
@SundasKhalid 2 жыл бұрын
hahaha you hit a soft spot with that comment. You know sadly I have experienced that in an interview and it all goes south from there real quick 😂
@vrindavaneshwari_ju_ki_kripa
@vrindavaneshwari_ju_ki_kripa 2 жыл бұрын
U r beautiful dear 😘
@letechnicaljames
@letechnicaljames 2 жыл бұрын
LeetCode SQL! haha nice video...i tried to make some sql videos last month and it is an enjoyable way to practice and review your thought process.
@DBatUTUE
@DBatUTUE 2 жыл бұрын
HI Sundas, why would you PARTITION BY id? id is a primary key, by definition any partition will thus contain a single row only.
@ShivamSingh-hx3yx
@ShivamSingh-hx3yx 2 жыл бұрын
I have a Question in Problem 1 what will happen if multiple employee have same salary i don't think row number will work there ? Example salary are as follow 500, 500, 300, 200 ---300 should be the correct answer right
@donniejoyce429
@donniejoyce429 Жыл бұрын
the qustion was meant to be read as "write an Ess Cue Ell" query
@ALI-qv9mq
@ALI-qv9mq 2 жыл бұрын
Salaam Alikum Sundas I'm your subscriber because you are pretty. where are you from???
@z2t942
@z2t942 2 жыл бұрын
Hahah bhai SQL seekho phir rishte ki sochna 😂
@ALI-qv9mq
@ALI-qv9mq 2 жыл бұрын
@@z2t942 buss yr kya bata ho
@z2t942
@z2t942 2 жыл бұрын
@@ALI-qv9mq seekhoge to milegi pyari bachi :) ..padhoge likhohe to banoge nawab ..
@ALI-qv9mq
@ALI-qv9mq 2 жыл бұрын
@@z2t942 hahaha soch raha ho ka miss ka pass sahe data scientist seklo
@ishanksaxena3329
@ishanksaxena3329 2 жыл бұрын
Great video ma'am. I'm working hard to get into business analytics and in data analytics role without being an Tec student. any tips will be awesome. Thanks :)
@shantanutripathi
@shantanutripathi 2 жыл бұрын
Today KZbin recommended me your channel, but I am still amazed to see only 49.5k subs till now. Added +1.
@MuhammadAbbas-bf9wo
@MuhammadAbbas-bf9wo 2 жыл бұрын
Complete SQL course
@YummyFoodSecrets1
@YummyFoodSecrets1 2 жыл бұрын
❤❤🇵🇰
@Shivam_.bharadwaj
@Shivam_.bharadwaj 2 жыл бұрын
I have to start learning SQL, So can you please suggest to me from where I should have started learning and which material I should have to follow.
@rijhumal3381
@rijhumal3381 2 жыл бұрын
It gives error for testcase {"headers":{"Employee":["id","salary"]},"rows":{"Employee":[[1,100]]}}
@SundasKhalid
@SundasKhalid 2 жыл бұрын
which problem?
@HemantSahu-hi4di
@HemantSahu-hi4di 2 жыл бұрын
Maam some courses for Hindi medium ... Apko Hindi aati h Pls Hindi m btaye naa pls
@meghap5641
@meghap5641 2 жыл бұрын
Hey sundas, that SecondHighestSalary code you have showed in this video doesn't satisfy all the test cases, in the question they have mentioned a case of 'null' situation which was not addressed in the query. Moreover rownum would give different output if two employees had samilar high salary, in that case rn=2 will fetch the highest sal instead of second highest. Thanks for sharing this video.. very informative 👏 😍🥰
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Thanks for catching that, Megha! How would you solve it? I think I need Leetcode premium version to test different use cases so I don’t miss it. Would love to see your solution.
@meghap5641
@meghap5641 2 жыл бұрын
@@SundasKhalid you don't need premium to find it, after running the query click on submit button, by doing so the compiler will check for rest of the hidden test cases and give us the results if the query passed or failed. I used the below query and it worked for all conditions: select max(Salary) as SecondHighestSalary from Employee where Salary not in (select max(Salary) from Employee)
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Thanks for the sharing that, Megha! That's a smart way to solve the problem. With my solution, it doesn't give the literal "Null" but instead gives 0 rows if there is only one row in the table. I guess I can wrap my code with ISNULL() to get the literal "Null" value, which would work too.
@antoanetamanko7457
@antoanetamanko7457 2 жыл бұрын
I found Leetcode quite limiting in the code it accepts when trying to solve this exact problem a while ago (which was quite frustrating). One of the very few solutions it recognizes is using MAX(), although a form of ISNULL() should also work. Personally, I'd find this use case of MAX weird in an interview setting. Curious what others think about it?
@SundasKhalid
@SundasKhalid 2 жыл бұрын
@@antoanetamanko7457 I agree with you. It's a bit overkill on the leetcode's part. I recently discovered StartaScratch and found it to be much better for data interview prep. I don't think I will spend more time on LC as it's more targeted toward SDE prep side.
@CRP3252
@CRP3252 2 жыл бұрын
2:11 "Write an 'ess queue elle'…" (the letters spelled out as opposed to pronounced 'sequel'☺️)
@itsrainingcatsanddogs
@itsrainingcatsanddogs 2 жыл бұрын
Come on Sundas buy a premium leetcode version now! we know you make good money from google as told by your father on your very own channel :'D
@SundasKhalid
@SundasKhalid 2 жыл бұрын
hahaha you are shaming me into buying a premium, I like it. On serious note, Leetcode is not that great for DS interview prep, so not worth it IMO. I might get stratscratch premium
@vikramv5654
@vikramv5654 2 жыл бұрын
Great to see you again mam😇 Please upload videos on the Internships Offered at Google for data analyst and also the prerequisite and Stipends.
@SundasKhalid
@SundasKhalid 2 жыл бұрын
I can't talk about Google but I'd definitely share my internship experience in one of the videos.
@vikramv5654
@vikramv5654 2 жыл бұрын
@@SundasKhalid Thank you So much mam🙏 Eagerly waiting for the video 😇🙏
@alfatmiuzma
@alfatmiuzma 2 жыл бұрын
Hi 😊 I was looking forward to this so eagerly 😀. Finally you did the part 2 , thanks a lot 😊😊❤️
@kayteeflick
@kayteeflick 2 жыл бұрын
This is super helpful. Submit your code to test it against all the test cases!
@rasifrana
@rasifrana 2 жыл бұрын
at 02:08 yes it is correct grammer. If it's a consonant sound you write a, if it's a vowel sound you write an (e.g. a university student but an umbrella). He sent me an SMS. so on
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Thanks for sharing!
@ayeshaakbar2896
@ayeshaakbar2896 2 жыл бұрын
Mam is it difficult to find Job after doing BS DATA SCIENCES ???
@SundasKhalid
@SundasKhalid 2 жыл бұрын
It can be hard to land any role without proper planning and strategy. That's why it's very important to plan ahead and follow it too so the job search part is easier.
@rahulpratapsingh5464
@rahulpratapsingh5464 2 жыл бұрын
Thanks! Really appreciate it!
@yukithejapanese
@yukithejapanese 2 жыл бұрын
Love this video because this shows those who work at big tech are no different than the rest of us!
@naeembrohi1821
@naeembrohi1821 2 жыл бұрын
Sundus Aapa, i have always been interested in Data science but wasn't searching and watching stuff about it but now your videos motivated me to start searching and learning about it.
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Amazing! All the best in your learning journey!
@atiffaisal8953
@atiffaisal8953 2 жыл бұрын
Please make a video on resume. How we can make a resume for Data science if I am not from mathematical background
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Will talk about resume at some point, thanks for the suggestion!
@VickyMei
@VickyMei 2 жыл бұрын
i really like this video and the lighting is perf!
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Thank you, Vicky! You feedback was super helpful, so glad I invested in good lighting.
@VickyMei
@VickyMei 2 жыл бұрын
@@SundasKhalid the lighting is EVERYTHING!
@observer698
@observer698 2 жыл бұрын
2:10 sql sometimes read as as-q-l :)
@bhuvangyerraguntla4880
@bhuvangyerraguntla4880 2 жыл бұрын
Please
@mehmetedex
@mehmetedex 2 жыл бұрын
2:07 :D there is no clear rule in english for it
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Thanks for sharing!
@binu1455
@binu1455 2 жыл бұрын
Thank you Sundas for this video ..i have a doubt regarding queries .. I haven't seen these clauses and functions (over clause, partition by, dense_rank()) while learning sql(i'm beginner ) and not even in google data analytics course ..did i miss something .. could you please mention where can i refer to .
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Hi Binu, you can learn the analytics function anywhere. W3School is a google place to learn and practice SQL as well as datacamp. There are many great courses on SQL that touch on these advanced analytics functions. Update us what path you end up taking.
@rakeshsn7245
@rakeshsn7245 2 жыл бұрын
these are popularly knows as window functions rather than analytical functions. Search as sql window functions in YT, you will get bunch of videos.
@alfatmiuzma
@alfatmiuzma 2 жыл бұрын
@@SundasKhalid thanks for mentioning the resources. I was also looking for it to practice 😊
@alfatmiuzma
@alfatmiuzma 2 жыл бұрын
@@rakeshsn7245 thanks rakesh
@ShamimKhan.17
@ShamimKhan.17 2 жыл бұрын
Mam kindly make a video how you got this job what are the roadmaps !!! 🙏
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Noted! I’ll consider it for sure
@ShamimKhan.17
@ShamimKhan.17 2 жыл бұрын
@@SundasKhalid thank you Mam !!! Actually currently I am a B.tech CSE (2nd year ) student so definitely it will help me 😇
@bhuvangyerraguntla4880
@bhuvangyerraguntla4880 2 жыл бұрын
Can you please also share cources for bachelors in data science 🥺
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Check my Instagram, I have shared a few Data Science courses there.
@aribashhar3960
@aribashhar3960 2 жыл бұрын
"How to record screen" search Tab.
@SundasKhalid
@SundasKhalid 2 жыл бұрын
Haha you can tell I don’t record screen often 😅
iPhone or Chocolate??
00:16
Hungry FAM
Рет қаралды 43 МЛН
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 58 МЛН
How Strong is Tin Foil? 💪
00:26
Preston
Рет қаралды 135 МЛН
iPhone or Chocolate??
00:16
Hungry FAM
Рет қаралды 43 МЛН