Category: Blog
-
SQL Interview Prep 6: For dealing with NULL values, why would I choose to use IFNULL vs. CASE WHEN?

365 Days of Daily Coding: Day It’s been a wild ride since I started working on this daily coding challenge. I have not been able to be consistent. As with any humans, there are days I just do not feel like it or that I wanna pore my limited resource over other burning matters. What’s…
-
SQL Interview Prep 5: LAG and LEAD are especially useful in what type of scenarios?

365 Days of Daily Coding: Day 113 LAG and LEAD are window functions that is always followed by an OVER clause. LAG function returns the preceeding value from the current row whereas LEAD function returns the succeeding value from the current row. The syntax for both LAG and LEAD are as follows: Both the function…
-
SQL Interview Prep 4: What happens if I GROUP BY a column that is not in the SELECT statement? Why does this happen?

365 Days of Daily Coding: Day 112 Part 1 What happens if I GROUP BY a column that is not in the SELECT statement? Why does this happen? When a GROUP BY column that is not in the SELECT statement is used, it will throw an error. By the order of operations in SQL, SELECT…
-
SQL Interview Prep 3: Why would I use DENSE_RANK instead of RANK? What about RANK instead of DENSE_RANK?

365 Days of Daily Coding: Day 111 Why would I use DENSE_RANK instead of RANK? What about RANK instead of DENSE_RANK? DENSE_RANK and RANK are functions used to rank records. The only key difference between them is that while RANK skips numbers/rank in case of ties whereas DENSE_RANK doesn’t skip numbers/rank and assigns consecutive numbers.…
-
SQL Interview Prep 2: Is it possible for LEFT JOIN and FULL OUTER JOIN to produce the same results? Why or why not?

365 Days of Daily Coding: Day 110 Is it possible for LEFT JOIN and FULL OUTER JOIN to produce the same results? Why or why not? LEFT JOIN: Returns all the records that are common between Table 1 and Table 2 as well as the non-matching records from Table 1. FULL OUTER JOIN: Returns all…
-
SQL Interview Prep 1: When will ROW_NUMBER and RANK give different results? Give an example.

365 Days of Daily Coding: Day 109 When will ROW_NUMBER and RANK give different results? Give an example. Both the functions ROW_NUMBER and RANK return an integer value that are incremental in nature. ROW_NUMBER as the name suggests assigns an incremental number to each subsequent rows whereas RANK functions ranks the records by values imposed…
-
Data Book Review: Effective Data Storytelling by Brent Dykes

This is a long awaited book review that I have been wanting to do for a while. It took me quite sometime to finish the book because I wanted to chew the contents really well before marking it as read. There’s really so much to take away from the book and I foresee myself re-reading…
-
Advance SQL Challenge: Using LEAD()

365 Days of Daily Coding: Day 108 Hello All, Posting this after much sometime. Mainly because I couldn’t wrap my head around the solution of this challenge. And then I was like “Hey, let’s try another challenge. And then it occured to me that there’s a solution to all the challenges in the site too.”…
-
Advanced SQL Challenge: Using LEVEL and CONNECT BY again

365 Days of Daily Coding: Day 107 I would have liked to say that I had a very happy time today but I won’t cause I am feeling extremely frustrated and angry right now. I used to think these emotions were invalid and unnecessary and cause more harm than good. Naturally, being an avid reader…
-
Advanced SQL Challenge: Using MOD()

365 Days of Daily Coding: Day 106 I rested and napped today. Isn’t it amazing that as an adult, you love napping more than anything? Oh, I also restarted my Korean classes which is a lot of fun. Although, I wonder when I would be able to speak fluently. I watch a lot of Korean…