- 29 minutes ago
Easy SQL interview questions become much less intimidating when you break them down step by step, and this lesson walks through two beginner-friendly Analyst Builder problems with clear MySQL logic. The first challenge, Car Failure, asks you to identify cars that passed inspection by filtering out any vehicle with critical issues or more than three minor issues, then returning the owner name and vehicle name in alphabetical order. The second, Apply Discount, focuses on counting customers who qualified for a 25% discount because they were over 65 or spent more than $200 on their first purchase.
Along the way, the walkthrough explains how to read the prompt carefully, choose the right WHERE conditions, and use COUNT when the question asks for a total instead of a list. It also shows how these SQL technical interview questions are used to test whether you really understand the logic behind filtering, ordering, and aggregation. This is a practical SQL tutorial for data analyst interview prep, MySQL practice, and anyone working through free easy questions on Analyst Builder.
Created for viewers searching for SQL interview questions, easy SQL practice, MySQL tutorial, data analyst technical interview prep, and Analyst Builder solutions. It is also useful for learners who want beginner SQL exercises, query-writing practice, and a calm step-by-step explanation of core SQL concepts.
Along the way, the walkthrough explains how to read the prompt carefully, choose the right WHERE conditions, and use COUNT when the question asks for a total instead of a list. It also shows how these SQL technical interview questions are used to test whether you really understand the logic behind filtering, ordering, and aggregation. This is a practical SQL tutorial for data analyst interview prep, MySQL practice, and anyone working through free easy questions on Analyst Builder.
Created for viewers searching for SQL interview questions, easy SQL practice, MySQL tutorial, data analyst technical interview prep, and Analyst Builder solutions. It is also useful for learners who want beginner SQL exercises, query-writing practice, and a calm step-by-step explanation of core SQL concepts.
Category
📚
LearningTranscript
00:00What's going on, everybody?
00:01Welcome back to another video.
00:02Today, we are gonna be solving
00:03easy SQL technical interview questions.
00:11Now, when I was interviewing for data analyst positions,
00:14I almost always got some type of technical interview.
00:16And the vast majority of the technical interviews
00:19that I got were in SQL.
00:20Not only that, but I was also on a hiring team
00:22and then later as a hiring manager,
00:24I almost always conducted
00:25some type of SQL technical interview.
00:27Now, why do hiring managers conduct these interviews?
00:29It's because they wanna make sure
00:30that you actually know the skill.
00:32Because you can just put SQL on your resume
00:34and not actually know it at all.
00:35And then when they hire you,
00:36they have to spend two, three, four months
00:38training you on the basics of SQL
00:40for you to actually understand it and use it.
00:42That is not what any hiring manager wants.
00:44And so that's why they conduct
00:45these SQL technical interviews.
00:47So in this series, we're gonna start with easy questions.
00:49That'll be in today's video.
00:50Then we'll go on to medium, hard,
00:51and then very hard SQL technical interview questions.
00:54So without further ado, let's jump onto my screen
00:56and take a look at the easy SQL interview questions.
00:58We're gonna be practicing these questions
01:00on analystbuilder.com.
01:01And if we come right over here,
01:03we can filter to the free questions
01:05and we can filter to the easy questions.
01:07These are all the free and easy questions
01:09that you can go and take right now.
01:10I will leave a link in the description.
01:12I will also leave a link to the two questions
01:14that we're gonna be looking at today,
01:16but go ahead and check out this
01:18if you wanna try out all of these different questions.
01:21There's also different difficulties.
01:22So we're gonna be working through the moderate
01:24and the hard ones in future videos.
01:27And then we'll also be looking at the very difficult ones
01:30in the very last video in this series.
01:32But let's go ahead and get rid of this
01:34because we're gonna go over to our very first question.
01:36Now, really quickly, I just wanna show you the interface
01:37before we actually dive into the question.
01:39Now, we're gonna be solving this in MySQL,
01:42but you can also practice in PostgreSQL
01:44and Microsoft SQL Server.
01:46Whichever one you have an interview coming up for,
01:48if that company uses Microsoft SQL Server,
01:51come in here and use Microsoft SQL Server.
01:53And we also have Python as well,
01:55but we're gonna be doing this in MySQL.
01:58This is where we'll write our actual SQL code.
02:01Then we have the prompt.
02:02Now, in an interview,
02:03typically they're gonna give you some type of prompt
02:05and then the data.
02:06They're gonna ask you to do something with the data.
02:09And our data is right down here.
02:11So this is our data.
02:12Now, this is a practicing platform, right?
02:15To practice for technical interview questions
02:17or practice for technical interviews.
02:19So we also have hints and expected output,
02:21as well as a video explanation walking through this question,
02:25showing you exactly how to do it.
02:27But if you can't get it at all,
02:29you can always come in here
02:30and look at the solution for any of these.
02:33But let's go ahead and start this question.
02:35The question is called car failure.
02:38It says, cars need to be inspected every year
02:40in order to pass inspection and be street legal.
02:43If a car has any critical issues,
02:45it will fail inspection.
02:47Or if it has more than three minor issues,
02:50it will also fail.
02:51Write a query to identify the cars that passed inspection.
02:54Outputs should include the owner name and vehicle name
02:57ordered by the owner name alphabetically.
03:00Now, let's go take a look at this data.
03:02So we have the owner name, vehicle name,
03:05minor issues, critical issues.
03:07And that's all we have.
03:09So it's just a simple one.
03:11Again, this is an easy question, at least on Analyst Builder.
03:16And so let's try to solve this without any of the hints
03:19or looking at the expected output,
03:21because I think we can solve this one.
03:23Now, the first thing that we need to take into consideration
03:26is we're gonna need to be filtering.
03:27So we'll need to filter down some data.
03:30So if a car has any critical issues, it'll fail.
03:33So if critical issues is one, two, three, it's gonna fail.
03:37So it can't have no critical issues.
03:42And they'll say and,
03:44because even though this says or right here,
03:47it doesn't mean one or the other.
03:49It means if it has this or it has this, it fails.
03:51So we actually need an and here.
03:53So both conditions need to be met.
03:55Or more than three minor issues.
04:00So you can't have either of those.
04:02Now, in our output for what we're gonna get down here,
04:06we need to have just two things.
04:09We just need the owner name and vehicle name.
04:12So let's put that, owner name and vehicle name.
04:16And then lastly, we just have to order by the owner name.
04:22And that's gonna be ascending, ASC.
04:25Ascending is just A to Z.
04:27So I think we can go ahead and start writing this out,
04:30because I think that's all we need to do.
04:32Now, let's go ahead and run this.
04:34And so we have our data right down here.
04:36Now, here's what we need to do.
04:38We are trying to identify cars that passed the inspection.
04:42So we need to filter out the ones that had a critical issue
04:46or that had three or more minor issues.
04:49So what we're gonna do is we're gonna come right over here.
04:51And the first one we'll do is critical issues.
04:53So we're gonna say where critical underscore issues.
05:00And we need to say is equal to zero.
05:03And let's run this.
05:04And it looks like I had a space here.
05:06Let's run this again.
05:07There we go.
05:08So now, these are cars that have no critical issues.
05:12So these ones are passing.
05:15But if we just look at our data right down here,
05:17we have some that have four, four, five.
05:21So we also have to say, and, and I'm gonna copy this
05:25so I don't have another problem with that.
05:28So I'm gonna say where it's less than or equal to,
05:32then I'm gonna say three.
05:33So if it has three or less, it should be in our output.
05:37So let's run this.
05:39And I said greater than, let me do less than.
05:42There we go.
05:44And we can see that now the minor issues
05:46are all three or less, and let's just make sure.
05:49Or if it has more than three.
05:51So if it had four or five, it should not be in our output.
05:54So these has three, two, zero, two, two, two.
05:57And this has zero, zero, zero, zero.
05:59So these are cars that should pass.
06:02Now, right now we've been selecting everything,
06:04but what we really need to do
06:06is just select the columns that we need.
06:09That's gonna be owner, underscore name, and vehicle.
06:14So let's run this.
06:15And this looks really good.
06:17And the last thing that we need to do is order by.
06:20So we need to order by the owner name.
06:24Let's get that owner name.
06:25And we need to do that in ascending.
06:27Now, by default, when you use order by to organize and sort a column, it automatically isn't ascending,
06:34but I like to at least put it there, you know, explicitly so I can see it.
06:39And this to me should be the correct answer.
06:41Now, what we need to do to check our answer
06:44and actually show if we got the answer right is just click this check answer button.
06:48We can also do control, shift, enter, but I'm gonna click the check answer.
06:53And there we go.
06:54We got the solution correct.
06:56So let's go ahead and come up here.
06:59We're gonna go to our next question.
07:01This is another easy question on analyst builder.
07:03Again, I'm gonna leave a link in the description if you want to try out this exact question.
07:07But let's take a look at this one.
07:09This is called apply discount.
07:11It says a computer store is offering a 25% discount for all new customers over the age of 65
07:17or customers that spend more than $200 on their first purchase.
07:20The owner wants to know how many customers received that discount since they started the promotion.
07:25Write a query to see how many customers received that discount.
07:29Okay, and let's go down and look at the data.
07:33So we have customer ID, we have their age, and then we have their total purchase.
07:38And let's just see if there's any duplicates in this customer ID.
07:43It doesn't look like it.
07:45It looks like they're all just one purchase.
07:47The reason I was looking at that is it says all new customers, and it looks like these
07:51are all new customers.
07:52It doesn't look like there's any repeat customers that are old customers.
07:56So we're gonna assume these are all new customers.
07:58If there was a multiple 1,001s, I would look for something like a transaction ID or a transaction
08:04date.
08:05But those types of questions are usually a little bit more difficult in like the medium
08:10hard types of questions.
08:12But let's go make some notes real quick.
08:14So we have to filter on two different things.
08:17They have to meet one of these criteria in order to be in the output.
08:21They either have to be over the age of 65.
08:24So over 65, and let's do over 65, or they just have to meet one of these, or have spent
08:32more than 200, or spent more than 200.
08:37And that shouldn't be capitalized.
08:40So that's what we need.
08:41And then the owner is just wanting to know how many customers received that discount.
08:45So we're going to do a count on the number of customers that fit that filter.
08:54I'll write it like that.
08:56So it's just gonna be a number in our output.
08:58This one should be, I would say, even a little bit simpler than the last one, because we're
09:03not having to filter or really do anything like that.
09:07Now let's run this.
09:09And let's come down here.
09:10So we're gonna do a count eventually on this customer ID.
09:13But what we need to do is filter on both the age and the total purchase.
09:18So let's write this out.
09:20So age needs to be, and I need to write where, where age is greater than 65.
09:27Now I'm not saying greater than or equal to, because right here it says for new customers
09:32over the age of 65.
09:33If it said age 65 or over, I would say greater than or equal to, I want to be, these
09:39questions
09:39can be very specific.
09:41And then we'll say, and, or actually, or, because it's either of these need to be true.
09:47Or the total purchase.
09:49And again, it says more than 200.
09:53So we're going to say greater than 200.
09:55Now let's run this and let's just kind of look down here.
09:59There's a lot of people that fit this bill, it looks like, yeah, the majority of people.
10:05That's great.
10:05So we're going to give them a discount.
10:07These are people that received a discount.
10:08So all we're going to do is account on this customer ID.
10:11So let's do account on customer ID.
10:15Let's run this.
10:16And our answer is 14.
10:18All we have to do is check this answer to make sure it is correct.
10:22So let's hit the check answer.
10:24And there we go.
10:25Your solution is correct.
10:27Now, one thing I will say about just technical interviews in general is oftentimes they want
10:32to make sure you know how to write it, but even more so they're really checking to make
10:35sure you understand how SQL works.
10:38So when I'm writing this out, if I'm in an actual interview, I would be talking this out
10:43loud to the interviewer who's interviewing me.
10:45I would say, okay, I looks like I need to filter on this and then I need to do account
10:49on these things.
10:50Now you only would know how to do that if you know MySQL or if you know SQL, right?
10:55Again, they really want to hear your thought process.
10:58And so walking through it exactly how I did in the actual interview is exactly what the
11:04interviewer wants to hear.
11:06Now writing it correctly is still very important, especially as you get to the more difficult
11:11questions, right?
11:12You want to know certain functions and certain ways to write things, but you should be talking
11:16all this out loud during your interview.
11:19Now, one of the really cool thing, I'm just going to show you this at the end is if I
11:21go
11:22over to my profile, I'm actually earning points for these questions.
11:26So right down here, I just earned a couple extra points towards my MySQL badge and I can
11:31go all the way up to expert and then master as well.
11:34And so I am well on my way.
11:36And then in future videos, when we do the medium and the hard and then the very hard questions,
11:40we earn even more points for those because they are more difficult and they go towards these
11:44badges.
11:44So that is how we solve those easy SQL technical interview questions on Analyst Builder.
11:48Go ahead and try those out.
11:49There's tons of other free questions on the platform that you can just try out and there's
11:53lots of easy ones, but then we're also going to be taking a look at medium, hard and very
11:57hard in future lessons.
11:59With that being said, I hope you enjoyed this video.
12:00If you did, be sure to like and subscribe below and I will see you in the next video.
12:14Bye.
12:14Bye.
12:15Bye.
Comments