Real Data Science SQL Interview Questions and Answers # 1 | Data Science Interview Questions

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

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

  • @TinaHuang1
    @TinaHuang1  4 года назад +123

    Btw I still HIGHLY recommend you get a whiteboard! I can make an entire video about why I think whiteboards are a data scientist's best friend haha.
    In any case, I hope this video is helpful for people doing quarantine interviews! When things get better (and if you guys like this type of video) I will go back to my beloved whiteboard 😂

    • @jessicajimmy5171
      @jessicajimmy5171 4 года назад

      ruclips.net/video/i2BjvSNJprA/видео.html

    • @saisowhitpb2484
      @saisowhitpb2484 3 года назад

      @@jessicajimmy5171 : Why didn't you consider writing an inner query as that's faster than the one you wrote?

    • @vky4050
      @vky4050 3 года назад +3

      I had a doubt after watching you video. If you are using date_trunc function why does the output show values as timestamp?

    • @ryandavis280
      @ryandavis280 3 года назад

      I would like that video, thank you!

    • @ravikrishnarpan
      @ravikrishnarpan 3 года назад

      Do you mean any tool or normal white board which they use in college.

  • @paulntalo1425
    @paulntalo1425 3 года назад +114

    What's beautiful about this video is that it doesn't just show the solution but the technique of how to approach the question to create better queries

  • @LayaWhite
    @LayaWhite 3 года назад +41

    Thank you for making this! I use SQL in my current job and I was wondering what types of SQL knowledge a potential employer would be looking for. This was really helpful!

  • @navarre2142
    @navarre2142 3 года назад +19

    I just started reviewing SQL yesterday after like a 2+ year IT/programming hiatus and got super excited after getting a decent chunk of the logic right :D no clue about timestamps and how to transform them though, so that's something I need to look further into.
    Great stuff, keep it up!

  • @jakelee2
    @jakelee2 4 года назад +6

    For someone who lives and works in the Bay Area, this is SO RELEVANT! It is helping me immensely in my journey and the best part is that this very closely mimics technical SQL interview questions you will receive at tech companies here. Thank you and keep posting this type of content please! :)

    • @TinaHuang1
      @TinaHuang1  4 года назад +3

      Yess I try to follow the tech interview structure as much as possible! Yay I’m so glad you’re enjoying them ❤️

  • @rhosseinipour4052
    @rhosseinipour4052 2 года назад +5

    this was so helpful, actually the most straight forward question+answer tutorial i've ever seen

  • @sog2531
    @sog2531 3 года назад +2

    Tina I just want to say thank you A LOT!!!!!
    I am so glad to see how to actually process a question!

  • @三条新月厨
    @三条新月厨 Год назад

    Hi Tina, I want to thank you again. I’m a CS student in mainland China, and constantly meet sexist comments such as “Women are naturally not good at tech as men”. I could be easily influenced by these kind of comments and started to question myself. But every time I watched your video about CS and tech, I feel confident and empowered as a woman again. Thank you so much Tina❤I wish you all the best

  • @yuejiang2066
    @yuejiang2066 3 года назад +9

    This is amazing ! Thank you so much to make this kind of video! I especially like the way that you lay out all the assumptions before you writing the query!

  • @torispadewtd5494
    @torispadewtd5494 2 года назад +1

    I'm going through your Sql Mock Interview series. It's cool seeing a preview of what the Interviews would look like!

  • @chaos8514
    @chaos8514 2 года назад +2

    Thank you...... Your work ethic inspires me

  • @tsahim.nuudelchin
    @tsahim.nuudelchin 4 года назад +3

    Hello Tina! I am super excited for your voice on behalf of women in the DS field and Asian as well. So loved the way you support beginners in the field.

    • @TinaHuang1
      @TinaHuang1  4 года назад +1

      Aww thank you!! Wow that would be a honour! I'm still learning so much every single day and hope that I can share the experience and knowledge I've gathered, as well as the new things I'm learning 😊

    • @tsahim.nuudelchin
      @tsahim.nuudelchin 4 года назад

      @@TinaHuang1 very encouraging! Have a nice weekend :)

  • @danielw7626
    @danielw7626 4 года назад +7

    Very good explanation, at least as I am in transitioning to DS field, your content really help me to build those logic. I love it and looking forward to see you post more video on this topic. Well done & good luck :)

    • @TinaHuang1
      @TinaHuang1  4 года назад +1

      I'm so happy you found it helpful!! Alright, will make more videos like these 😄

    • @jessicajimmy5171
      @jessicajimmy5171 4 года назад

      ruclips.net/video/i2BjvSNJprA/видео.html

  • @jamesjanning8791
    @jamesjanning8791 3 года назад +5

    Hi Tina. I love your SQL videos. Thanks a ton for your channel and all the great content. I wanted to point out what I think might be a missing assumption for the solution presented in this problem. I think using the DATE_TRUNC() function here requires the assumption of all the logs occurring within the same month. Unless I'm mistaken, that function used across multiple months, would aggregate the 1st of January, 1st of February, 1st of March, etc. into day 1. If we assume the logs span a greater segment of time, such as a year, then another function may be needed in a sub-query or CTE. The DATEDIFF function could be used to get the difference between two timestamps, and round the output to days - example: DATEDIFF(dd, i.ts, w.ts) AS DaySpan - Then we could filter results to where DaySpan = 0.

    • @TinaHuang1
      @TinaHuang1  3 года назад

      Ohh nice catch!!

    • @CNDVideoProductions
      @CNDVideoProductions 3 года назад

      Or you could just CAST the datetime to a date. CAST(i.ts AS date), same for the join.

    • @reflectlight
      @reflectlight 3 года назад +1

      But DATE_TRUNC with day includes the month and the year, so I don't think this is an issue! It's truncating to the day (so removing time info but not the year or month), instead of extracting the day on its own.
      If you used EXTRACT('day' from ts) then yes you would definitely have that issue!

  • @Rhea_reading_room
    @Rhea_reading_room 3 года назад +2

    I'm a final year undergraduate in computer science and I was really confused what should I do, what languages I should learn but after I discovered your channel and subscribed it ofc I've decided to be a data scientist. Thank you so much for encouraging me. I just want to let you know that your videos have so much impact on your audience and please stay motivated for us and upload more video like this. Love you

    • @candidlyvivian
      @candidlyvivian 3 года назад

      Hey Rhea! Glad to hear that you are considering a career in data science! Im a fellow fan of tinas videos (so helpful!) and small RUclipsr - I’ve got some videos up on my channel on my work and career tips as a data scientist, maybe they’d help you out? 🙂

    • @Rhea_reading_room
      @Rhea_reading_room 3 года назад

      @@candidlyvivian Hi candidly Thank you for your kind works and of course I'll check out your account right away and you got yourself a new subscriber too:)

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

      How is it going with your career so far as a date scientist I’m in a similar situation final year and unsure what path to take

  • @winnumber101
    @winnumber101 3 года назад +8

    This was really smooth haha-I learned a lot. Thanks Tina!

    • @TinaHuang1
      @TinaHuang1  3 года назад +3

      Yay I'm so glad you liked it! :D

  • @sanjaymehta5872
    @sanjaymehta5872 3 года назад +23

    Thank you! The moment when it threw that error and everyone's heart sank 🤣. Great video and walk through

  • @owlcatxx
    @owlcatxx 3 года назад +4

    "Let me know if I'm repeating myself repeatedly" 👌🏼Love the humor! Keep up these videos, they are super useful and your delivery is great - clear and easy to connect with

    • @TinaHuang1
      @TinaHuang1  3 года назад

      😂 thank you so much!!! And will do ❤️

  • @sehaj778
    @sehaj778 3 года назад +2

    This was soo great. The unfiltered ones are the best. Could really see your thought process. Thank you! Subscribed definitely!

    • @TinaHuang1
      @TinaHuang1  3 года назад

      Yay I’m so glad to hear that!!

  • @drraxinarc12
    @drraxinarc12 4 года назад +6

    I've started learning from the SQL Sunday resources. Its very useful. Thanks for the content

    • @TinaHuang1
      @TinaHuang1  4 года назад

      Yay I’m so glad! ❤️❤️

  • @giulianobarrella6080
    @giulianobarrella6080 2 года назад

    This is amazing Tina, thank you so much!!! Please keep posting this amazing content!

  • @jayashukla4799
    @jayashukla4799 3 года назад +2

    For someone like me who wants to switch careers to data science, this is very helpful, please keep making videos. LoveYou :)

    • @TinaHuang1
      @TinaHuang1  3 года назад

      YAYY I’m so glad you enjoyed it!! ❤️❤️

  • @tqw1423
    @tqw1423 3 года назад +1

    I just completed my interview loop on Amazon. Thank you for the contents! All the best!

  • @melat4400
    @melat4400 3 года назад +4

    New subscriber and just wanted to say love your content, Tina!

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

    Tina you are a breath of fresh air. Very precise presentation, perfect pronounciation in English, just the right length of the video. Keep the sql videos coming. Well done.

  • @SaurabhAgrawal32
    @SaurabhAgrawal32 3 года назад +1

    Great stuff, thanks 😊 I am working as lead analyst - digital transformation and wish to be a data scientist. Learning a lot from you, Thanks 😊

  • @kevinlandgraf
    @kevinlandgraf 3 года назад +3

    video was amazing as a sql beginner, it was so fun to actually understand the coding

  • @thepresident617
    @thepresident617 6 месяцев назад

    1. start off with making assumptions
    2. write steps to what you need to do (1.join 2.match by day …)
    3. outline what a final output look like
    4. code
    5. review
    6.optimize

    • @thepresident617
      @thepresident617 6 месяцев назад

      Assumptions. Steps. Output. Review. Optimize.
      Always Start Out Right, Okay?

  • @isaactucker-rasbury710
    @isaactucker-rasbury710 3 года назад +2

    Great video and I like this live coding style. If you continue live coding SQL/at all could you go through SQL beginner, intermediate, and advanced techniques? But, all that said, I really enjoy these videos.

  • @daniellamarie8155
    @daniellamarie8155 2 года назад

    I’m familiar with sql but this is very helpful I didn’t know you could query like this. Thank you!

  • @PixelsWorkshopVideos
    @PixelsWorkshopVideos 3 года назад

    excellent and on-point. Subscribed Tina!

  • @surgez3806
    @surgez3806 3 года назад

    SQL Sundays playlist made my day

  • @mintaowei2686
    @mintaowei2686 3 года назад +1

    Big thumbs up!! Very clearly explained. Really enjoyed it! It would be really appreciated if you could also make some videos to talk about what the real live SQL questions look like, because it seems to me that those real questions are quite different from Leetcode SQL questions (e.g. sometimes we need to come up with metrics to select ourselves, sometimes there is no sample result preview, etc )

    • @TinaHuang1
      @TinaHuang1  3 года назад +1

      Hi! Yup now that I’ve been working for a while, the actual hard part for tackling a SQL question is figuring out what the question even is + finding data. Also there’s the constant paranoia of whether your query is doing what you think it’s doing since there’s obviously no answer key D: I should definitely make a video on this topic! Thanks for suggesting!!

    • @mintaowei2686
      @mintaowei2686 3 года назад

      @@TinaHuang1 😄😄

  • @franciscobarillas8500
    @franciscobarillas8500 2 года назад

    Thank you, this is very useful and written effectively. Right pace and to the point.

  • @ravitanwar9537
    @ravitanwar9537 4 года назад +2

    this is good but i'll recommend covering basic data structure and leetcode type questions essential for data science interviews since not many youtubers have covered that and also since you have experienced the same in your interview :)
    amazing video as always;liked ..

    • @TinaHuang1
      @TinaHuang1  4 года назад +4

      Yeah, someone else mentioned that too! Okay - will do some more research on what exactly companies are asking these days and draft for a future video. For my own data science interview, there were actually no algorithm questions asked. Although I was asked plenty of leetcode type questions for my SWE interviews so I do have some experience doing them.

    • @ravitanwar9537
      @ravitanwar9537 4 года назад +1

      @@TinaHuang1 oh is that so?no leetcode types(be it easy) questions asked for data science interview ? ok then you can continue making the videos in the same way then ! also it'll be really good video idea where you share your interview exp as a data scientist for the untitled company :)
      oh and here is one reference interview exp with amazon for data scientist role
      leetcode.com/discuss/interview-experience/324656/Amazon-or-Data-science-Intern-or-Seattle-Offer

    • @TinaHuang1
      @TinaHuang1  4 года назад

      Oh cool - will check it out! 😊

    • @ravitanwar9537
      @ravitanwar9537 4 года назад

      @@TinaHuang1 sure

    • @jessicajimmy5171
      @jessicajimmy5171 4 года назад

      ruclips.net/video/i2BjvSNJprA/видео.html

  • @melaleucatree
    @melaleucatree 2 года назад

    GREAT VIDEO! PLEASE MAKE MORE LIKE THIS!

  • @konstantin6482
    @konstantin6482 3 года назад

    Awesome stuff, liked the approach of writing given/asked

  • @Expert_Transcript_Helpers
    @Expert_Transcript_Helpers 2 года назад

    I have no idea what's going on and I want to start learning. This is giving me anxiety that I wouldn't be this brilliant

  • @ElPapelMan
    @ElPapelMan 4 года назад +1

    Liked the video, and subscribed to the channel. Liking the content, keep up the good work!

    • @TinaHuang1
      @TinaHuang1  4 года назад +1

      Yay I'm so glad! Thank you!

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

    Thank you for this, I found this video helpful!

  • @lastairbender_883
    @lastairbender_883 3 года назад +1

    It's a nice video. I think your approach to the problem could be a little better. The goal should be to find three pieces of information. The count of those who only signed in from phone, those who only signed in from web, and those that did both.
    The answer to the question is the count of those that do both. But the veracity of the answer is dependent upon all three.
    An interviewer can be asking multilayered questions. You established your ability to write the query. You may have missed the opportunity to demonstrate your analytical skill.

    • @TinaHuang1
      @TinaHuang1  3 года назад +1

      Fair point! I could work on conveying more analytical reasoning! Thanks for the feedback :)

  • @123hypes
    @123hypes 4 года назад +3

    What kind of SQL would you reccomend learning? MYSQL or postgresql. Love your channel btw!

    • @TinaHuang1
      @TinaHuang1  4 года назад +3

      Thank you! ❤️❤️ it really doesn’t matter which kind, they don’t care as long as it’s not something wayyy obscure. I prefer Postgresql because it has more handy functions!

    • @jessicajimmy5171
      @jessicajimmy5171 4 года назад

      ruclips.net/video/i2BjvSNJprA/видео.html

  • @mdhossainsami2062
    @mdhossainsami2062 4 года назад +10

    Can you do a SQL learning series for beginners? it Will be great

    • @TinaHuang1
      @TinaHuang1  4 года назад +3

      Ohh I'll definitely consider it! Thanks for the suggestion 😊

  • @LourinDoss
    @LourinDoss 4 месяца назад

    Love the vid, thank you!!

  • @erichamm7198
    @erichamm7198 3 года назад

    Great video. Your solution was succinct and that's what interviewers want.

  • @erinhwang217
    @erinhwang217 3 года назад

    Wow! What an effective and thorough video... I will def be watching more. Which application are you using to store your code? I’ve attempted to keep a repository of useful code I always go back to but vscode is not good for that. The interface you’re using looks way better.

  • @scottqian7687
    @scottqian7687 3 года назад +1

    Better do aggregation before table joining, or simply use union instead of joining for this scenario. Log tables usually are huge, even after partitioned.

    • @dincamarius-catalin9848
      @dincamarius-catalin9848 3 года назад

      Aggregation before joining, I can understand..but why UNION? UNION is usually a "heavy" operation

  • @larigiba
    @larigiba 4 года назад

    Awesome! I recently bought a whiteboard to practice LeetCodes but I guess digital practice is even more important now. Also congrats on the rapid growth in the past days, I'm sure your channel will take off even more! 🚀

    • @TinaHuang1
      @TinaHuang1  4 года назад

      Yeah - very sad but impossible to avoid because COVID is ruining everything 😢 I think you mentioned that you just started university though so you'll still have plenty of chances to whiteboard for the coming years haha. And thank you!! You've been so amazingly supportive since day 1 on this channel and I'm so grateful 🥰

    • @larigiba
      @larigiba 4 года назад

      True!
      Yes I just finished my first semester so I probably get to see both sides of the coin :D
      But it's just so exciting I can't wait to start haha!
      I'm glad you appreciate it!! Your videos have been really helpful and I wanted to give back a bit of that positive and helpful energy! Keep going! 😁

    • @TinaHuang1
      @TinaHuang1  4 года назад

      Will do!! ❤️❤️

    • @jessicajimmy5171
      @jessicajimmy5171 4 года назад

      ruclips.net/video/i2BjvSNJprA/видео.html

  • @sivakrishnat5471
    @sivakrishnat5471 3 года назад

    very impressive. pace is perfect. Just keep the same way nd make more videos.

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

    Should we not pre-aggregate the tables to day frequency before joining? The result would be the same but would it not be more optimized since the number of rows will decrease for both tables before joining?

  • @MrInsanepotato
    @MrInsanepotato 3 года назад

    Hey this was pretty simple for me and I am not a data scientist nor an engineer. I used codecademy course on sql, learned it in about a week. I highly recommend it.

    • @TinaHuang1
      @TinaHuang1  3 года назад +1

      Yup - the actual questions themselves are really not very hard at all :) what’s the most important for these interviews is your ability to communicate and think critically/course correct when challenged

  • @Ash-ku2rz
    @Ash-ku2rz 2 года назад

    Thank you, so much for such detailed videos, this is super helpful.

  • @Addicted2OILau
    @Addicted2OILau 3 года назад

    Hello I Tina. I liked and subscribed. Do you have an option for Date aswell ? Jk. Keep the content coming. If you publish any short courses I would totally buy that. Great video clear explaining 👍

  • @manuelnovella39
    @manuelnovella39 3 года назад

    Nice! Keep it up! It was very useful. Please do more!

    • @TinaHuang1
      @TinaHuang1  3 года назад

      I have!! haha there are 7 more as part of SQL sundays playlist linked in descriptions :)

  • @abadlibadreddine1960
    @abadlibadreddine1960 2 года назад

    I was thinking about getting a whiteboard for quite some time and now after watching this i'm 100% getting one

  • @lipuntat
    @lipuntat 3 года назад

    Hi, Tina...videos are very nice and intuitive. Keep adding more videos on SQL and please gives links for .SQL file ..for our practice

  • @chineduezeofor2481
    @chineduezeofor2481 3 года назад +1

    I totally enjoyed the video. Keep it up!

  • @kristenedwards7605
    @kristenedwards7605 2 года назад

    Thank you!! This was great!

  • @jkk23-g7c
    @jkk23-g7c 3 года назад +1

    Finally I understand everything in the video 😁😁. Great video, thanks.

  • @mayanklathar5275
    @mayanklathar5275 3 года назад

    Nice stuff for beginners like me. But, when do you stop learning or giving time to a language? when do you say it's more than enough?

  • @Clay625
    @Clay625 4 года назад +1

    This is super helpful , gonna binge your other videos. Thankyou.

  • @jbuttercup
    @jbuttercup 3 года назад

    I am so glad I found your channel! My goal is to learn SQL (I only know R so far-not enough!!) and this content is super helpful. :)

  • @mohamedafilal3912
    @mohamedafilal3912 3 года назад +3

    Great explanation, but I believe the query is false, you need to specify a "full join" instead of just "join"
    Because in your query if one user exists in just one table (web or iPhone) it won't be selected (inner join)
    Cheers

    • @humbertogzz
      @humbertogzz 3 года назад

      I am completely shocked, that no one is pointing that out...

    • @chaos8514
      @chaos8514 2 года назад +2

      But the question says 'from both iphone and web' ............. Am i correct????

  • @juniordataengineer
    @juniordataengineer 4 года назад +1

    I like the content..... Thanks for taking time to create such great content.... and may the channel hit 10,000k subs soon ☺️

    • @TinaHuang1
      @TinaHuang1  4 года назад

      Yay I'm so happy you like it ^^ Fingers crossed 😊

  • @CodeWithEric
    @CodeWithEric 3 года назад

    Thanks Tina for providing great content

  • @abhinavsharma2308
    @abhinavsharma2308 3 года назад +1

    i guess you can also try union instead of a join as both tables are of a similar structure. I don't know about Postgres, but MySQL does have that.

    • @dincamarius-catalin9848
      @dincamarius-catalin9848 3 года назад

      UNION is the least optimal solution...avoid it unless you need it

    • @brothermalcolm
      @brothermalcolm 3 года назад

      Same here, instead of matching to multiple keys in the join where ts is probably non-indexed, you can directly aggregate twice after a union to arrive at the same answer

  • @emma_ding
    @emma_ding 3 года назад +1

    Nice explanation, Tina!

  • @farhanaugustiansyah3227
    @farhanaugustiansyah3227 3 года назад

    Thanks a lot. Now i can know about interview questions

  • @daeunim1541
    @daeunim1541 3 года назад +3

    Thanks for making such a helpful video! I was wondering where can get I these questions from??

    • @TinaHuang1
      @TinaHuang1  3 года назад +3

      Hi! I got these questions from Glassdoor but in my other SQL Sunday videos i get them from scratascratch, which I have an affiliate link for in my other SQL Sunday videos (at no cost to you) if you wanna check that out :)

  • @MrJbramirez
    @MrJbramirez 3 года назад

    I'm confused. Knowing sql will make me a data 'scientist'? 😱 That's a dope job description.

  • @grelgen
    @grelgen 3 года назад +3

    two things:
    1. would date diffing on i.ts and w.ts less than 24 to catch global clocks have been bonus points or outside of the question?
    2. is GROUP BY 1 short hand?

    • @duckmeat4674
      @duckmeat4674 3 года назад +2

      1. outside of the question, since the time would be server time which sould just be in one timezone
      2. Group by 1 is group by first column, so yes shorthand
      She could have also used USING(id) instead of ON...

  • @ruchibhatt3347
    @ruchibhatt3347 2 года назад

    thanks for the video . great!

  • @alexandre5150
    @alexandre5150 3 года назад

    It is really helpful. Thank you!

  • @muzafferckay2609
    @muzafferckay2609 2 года назад

    In my view it will be more meaningfull to create a session table rather than iPhone and web. The session table should contain a column to represent the client type.

  • @jt099
    @jt099 3 года назад

    Love the content!

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

    Great job good speed and most of use probably watch on 1.25 seep

  • @AndrewMoMoney
    @AndrewMoMoney 4 года назад +1

    Great walk through!

  • @chrislin6308
    @chrislin6308 4 года назад +1

    Hello Tina, thanks for the video it is really useful. in this questions you used pg instead of mysql and i wonder during the interview, did you got to choose which you want to use?

    • @TinaHuang1
      @TinaHuang1  4 года назад +2

      Hi! Yup I prefer Postgres because it has way more handy functions. Companies don’t care which sql you use usually unless it’s some really weird and rare one haha

  • @vishnugovindan8550
    @vishnugovindan8550 3 года назад

    Do you have any resources for SQL questions sets that you used while preparing? Thanks again for the content Tina!

  • @kojently
    @kojently 2 года назад

    hi! thanks for making this video -- it's super helpful. could you explain why you grouped by 1?

    • @chaos8514
      @chaos8514 2 года назад

      Group by 1 means grouping by 1st column from your select clause ... u can use group by 2 also to group by 2nd column

  • @sarikakondakindi7744
    @sarikakondakindi7744 3 года назад

    Tina , I think you can have another column with date data type and use that date data type column in select where and group by because if we think that table has millions or billions of records i think date_trunc will affect performance negatively, please let me know your thoughts, thanks.

  • @sudheerkhatravath2243
    @sudheerkhatravath2243 3 года назад

    👏🏼👏🏼👏🏼👏🏼 thanks for ur knowledge sharing... liked it 😅

  • @arafamahmood9356
    @arafamahmood9356 3 года назад

    very effective tutorial, thank you very much for your effort!

    • @observatoirelibredesbanque1743
      @observatoirelibredesbanque1743 2 года назад

      What do you do your GROUP BY with 1 and not with the non aggregate columns of the Select statement, as the aggregate functions syntax requires it? I do not understand.

  • @observer698
    @observer698 4 года назад

    I bet you heard this a lot but you are a very good teacher!

    • @TinaHuang1
      @TinaHuang1  4 года назад

      ahh really?? I'm so flattered! Nobody has told me that before haha. Thank you!

    • @jessicajimmy5171
      @jessicajimmy5171 4 года назад

      ruclips.net/video/i2BjvSNJprA/видео.html

  • @shyamsundark1556
    @shyamsundark1556 3 года назад +1

    Can we also use an intersect instead ?
    with used_both as
    (
    Select distinct date, user from iphone
    intersect
    Select distinct date, user from web
    )
    select u.date, count(u.user) from used_both u group by u.date order by u.date asc

    • @TinaHuang1
      @TinaHuang1  3 года назад

      I always encourage people to try it out 😉 it’s the best way to learn! Also tbh it’s been a while since I’ve done this question and don’t exactly remember 🙈

  • @goldblueranger
    @goldblueranger 3 года назад +1

    good job, but this query will not scale with number of sessions. E.g. imagine edge case when one day has 1 billion sessions from 100 users. It will be much more optimal to select unique users from each table, then join, then count.

    • @TinaHuang1
      @TinaHuang1  3 года назад +1

      Very true - pointing that out in interview would be awesome!!

  • @shadowofcol3651
    @shadowofcol3651 3 года назад

    Thank you for this video, advantageous one !!

  • @anistroudi766
    @anistroudi766 3 года назад

    Good video! PS: would appreciate if you explained Group By 1 in the video. I had to stuck overflow it ;)

    • @TinaHuang1
      @TinaHuang1  3 года назад

      Ohh true! Will do next time :) Thanks for letting me know!

  • @stellaxu8861
    @stellaxu8861 2 года назад +1

    Hi Tina, thanks for sharing this. I have a small question (might be stupid): if some users log in several times both from iPhone or web, I mean 'multi to multi relationships', could we still use these queries? Or should we make any changes? Thanks so much!

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

      Hello stella, I just tried this case out (same user logs in multiple times on both iPhone and web in one day) and the user is still only counted once. I believe this is because of the DISTINCT statement. On a given day each user can only be counted once.

  • @learnanalyticsorg
    @learnanalyticsorg 4 года назад

    Tina, this is awesome. Really like your videos here. I am exactly in line with you, I started my channel to try to help people in the career of data as well. Cheers.

    • @TinaHuang1
      @TinaHuang1  4 года назад +1

      Thank you 😊 And that's awesome!!

    • @jessicajimmy5171
      @jessicajimmy5171 4 года назад

      ruclips.net/video/i2BjvSNJprA/видео.html

  • @lucyhaddant1303
    @lucyhaddant1303 3 года назад

    Great video. Very useful indeed. THANK YOU SO MUCH

  • @yonaabz8672
    @yonaabz8672 3 года назад

    Hi Tina ! Thanks for your content . I have a solution with WHERE instead of JOIN to join the tables. In your opinion which one is the best in term of optimization? and why ? thks:)

    • @dincamarius-catalin9848
      @dincamarius-catalin9848 3 года назад

      It's hard to say. It's really depending on the database you are using, the amount of data you are running your sql against and the tables structures, but usually the JOIN is faster, because the databases have several algorithms for performing the joins (hash join for example is faster when you are dealing with small tables, while merge join is faster when you are dealing with large tables), while the where clause depends on the structure of the table, like does have indexes, are the statistics valid, is the index created on the column in where clause...and the optimizer may or may not chose to use that information in the where clause and just do a full table scan, which is something you tend to avoid...

  • @fuu812
    @fuu812 3 года назад

    Thanks for this video please do more on the subject

  • @alejandro_borges
    @alejandro_borges 3 года назад

    Great video! Thanks for sharing 😃👏🏻

  • @Steven-up9ds
    @Steven-up9ds Год назад

    This will be helpful for you.

  • @justinogarcia3705
    @justinogarcia3705 3 года назад

    You should check out azure data studio is a free Microsoft sql ide.
    But it only support sql server and postgress. Also
    Support notebooks with python or sql
    Kernel.

    • @TinaHuang1
      @TinaHuang1  3 года назад

      Ohh will do! Thanks for suggesting

  • @ankeetashah1043
    @ankeetashah1043 3 года назад

    Can you please explain Why have you used join on date column here ,Is it needed? and how results would have been different if you skip date condition ?

  • @pavanpc5146
    @pavanpc5146 2 года назад

    Which SQL is better to lear MYSQL or Postgrace SQl to stay in Data Domain

  • @yungchat5160
    @yungchat5160 3 года назад

    Hi Tina to practice these live code interviews do you have any question banks or resources you would recommend, besides LC or hackerrank?

  • @normanhandy4174
    @normanhandy4174 3 года назад

    My only question is the assumption about the inner join of the iPhone and web logs. Wouldn't it be more logical if the entity were concerned with customer activity from any source and the "test" for the interviewee would be to consolidate customer activity from any source and then count for "uniqueness"?