 What's going on everybody? Welcome back to another video. Today we're going to be solving easy SQL technical interview questions. Now, when I was interviewing for data analyst positions, I almost always got some type of technical interview. And the vast majority of the technical interviews that I got were in SQL. Not only that, but I was also on a hiring team. And then later as a hiring manager, I almost always conducted some type of SQL technical interview. Now, why do hiring managers conduct these interviews? It's because they want to make sure that you actually know the skill, because you can just put SQL on your resume and not actually know it at all. And then when they hire you, they have to spend two, three, four months training you on the basics of SQL for you to actually understand it and use it. That is not what any hiring manager wants. And so that's why they conduct these SQL technical interviews. So in this series, we're going to start with easy questions that will be in today's video. Then we'll go on to medium hard and then very hard SQL technical interview questions. So without further ado, let's jump on my screen and take a look at the easy SQL interview questions. We're going to be practicing these questions on analystbuilder.com. And if we come right over here, we can filter to the free questions and we can filter to the easy questions. These are all the free and easy questions that you can go and take right now. I will leave a link in the description. I will also leave a link to the two questions that we're going to be looking at today. But go ahead and check out this if you want to try out all of these different questions. There's also different difficulties. So we're going to be working through the moderate and the hard ones in future videos. And then we'll also be looking at the very difficult ones in the very last video in this series. But let's go ahead and get rid of this because we're going to go over to our very first question. Now really quickly, I just want to show you the interface before we actually dive into the question. Now we're going to be solving this in MySQL. But you can also practice in PostgreSQL and Microsoft SQL Server, whichever one you have an interview coming up for. If that company uses Microsoft SQL Server, come in here and use Microsoft SQL Server. And we also have Python as well. But we're going to be doing this in MySQL. This is where we'll write our actual SQL code. Then we have the prompt. Now in an interview, typically they're going to give you some type of prompt and then the data. They're going to ask you to do something with the data. And our data is right down here. So this is our data. Now this is a practicing platform, right, to practice for technical interview questions or practice for technical interviews. So we also have hints and expected output, as well as a video explanation walking through this question showing you exactly how to do it. But if you can't get it at all, you can always come in here and look at the solution for any of these. But let's go ahead and start this question. The question is called car failure. It says cars need to be inspected every year in order to pass inspection and be street legal. If a car has any critical issues, it will fail inspection or if it has more than three minor issues, it will also fail. Write a query to identify the cars that passed inspection, output should include the owner name and vehicle name ordered by the owner name alphabetically. Let's go take a look at this data. So we have the owner name, vehicle name, minor issues, critical issues. And that's all we have. So it's just a simple one. Again, this is an easy question, at least on Analyst Builder. And so let's try to solve this without any of the hints or looking at the expected output. Because I think we can solve this one. Now the first thing that we need to take into consideration is we're going to need to be filtering. So we'll need to filter down some data. So if a car has any critical issues, it'll fail. So if critical issues is one, two, three, it's going to fail. So it can't have no critical issues. And they'll say and, because even though this says or right here, it doesn't mean one or the other. It means if it has this or it has this, it fails. So we actually need an and here. So both conditions need to be met, or more than three minor issues. So you can't have either of those. Now in our outputs for what we're going to get down here, we need to have just two things. We just need the owner name and vehicle name. So let's put that owner name and vehicle name. And then lastly, we just have to order by the owner name. And that's going to be ascending ASC ascending to just a to Z. So I think we can go ahead and start writing this out because I think that's all we need to do. Now let's go ahead and run this. And so we have our data right down here. Now here's what we need to do. We are trying to identify cars that passed the inspection. So we need to filter out the ones that had a critical issue or that had three or more minor issues. So what we're going to do is we're going to come right over here. And the first one we'll do is critical issues. So we're going to say where critical underscore issues and we need to say is equal to zero. And let's run this. And it looks like I had a space here. Let's run this again. There we go. So now these are cars that have no critical issues. So they're pat, these ones are passing. But if we just look at our data right down here, we have some that have four, four, five. So we also have to say, and, and I'm going to copy this so I don't have another problem with that. So I'm going to say where it's less than or equal to, and I'm going to say three. So if it has three or less, it should be in our output. So let's run this. And I said greater than. Let me do less than. There we go. And we can see that now the minor issues are all three or less. And let's just make sure or if it has more than three. So if it had four or five, it should not be in our output. So these has three, two, zero, two, two, two. And this has zero, zero, zero, zero. So these are cars that should pass. Now right now we've been selecting everything. But what we really need to do is just select the columns that we need. That's going to be owner underscore name and vehicle. So let's run this. And this looks really good. And the last thing that we need to do is order by. So we need to order by the owner name. Let's get that owner name. And we need to do that in ascending. Now by default, when you use order by to organize and sort a column, it automatically is an ascending. But I like to at least put it there, you know, explicitly so I can see it. And this to me should be the correct answer. Now what we need to do to check our answer and actually show if we got the answer right is just click this check answer button. We can also do control shift enter. But I'm going to click the check answer. And there we go. We got the solution correct. So let's go ahead and come up here. We're going to go to our next question. This is another easy question on Analyst Builder. Again, I'm going to leave a link in the description if you want to try out this exact question. But let's take a look at this one. This is called apply discount. It says a computer store is offering a 25% discount for all new customers over the age of 65 or customers that spend more than $200 on their first purchase. The owner wants to know how many customers received that discount since they started the promotion. Write a query to see how many customers received that discount. Okay. And let's go down and look at the data. So we have customer ID, we have their age, and then we have their total purchase. And let's just see if there's any duplicates in this customer ID. It doesn't look like it looks like they're all just one purchase. The reason I was looking at that is it says all new customers. And it looks like these are all new customers. It doesn't look like there's any repeat customers that are old customers. So we're going to assume these are all new customers. If there was a multiple 1000 and ones, I would look for something like a transaction ID or a transaction date. But those types of questions are a little usually a little bit more difficult in like the medium hard types of questions. But let's go make some notes real quick. So we have to filter on two different things. They have to meet one of these criteria in order to be in the output. They either have to be over the age of 65. So over 65. And let's do over 65. Or they just have to meet one of these or have spent more than 200 or spent more than 200. And that's shouldn't be capitalized. So that's what we need. And then the owners just wanting to know how many customers received that discount. So we're going to do a count on the number of customers that fit that filter. I'll write it like that. So it's just going to be a number in our output. This one should be I would say even a little bit simpler than the last one, because we're not having to filter or really do anything like that. Now let's run this. And let's come down here. So we're going to do a count eventually on this customer ID. But what we need to do is filter on both the age and the total purchase. So let's write this out. So age needs to be and I need to write where where age is greater than 65. Now I'm not saying greater than or equal to because right here it says for new customers over the age of 65. If it said age 65 or over, I would say greater than or equal to I want to be these questions can be very specific. And then we'll say and or actually or because it's either of these need to be true or the total purchase. And again, it says more than 200. So we're going to say greater than 200. Now let's run this. And let's just kind of look down here. There's a lot of people that fit this bill. It looks like the majority of people. That's great. So we're going to give them a discount. These are people that received a discount. So all we're going to do is account on this customer ID. So let's do account on customer ID. Let's run this. And our answer is 14. All we have to do is check this answer to make sure it is correct. So let's hit the check answer. And there we go. Your solution is correct. Now one thing I will say about just technical interviews in general is oftentimes they want to make sure you know how to write it. But even more so, they're really checking to make sure you understand how SQL works. So when I'm writing this out, if I'm in an actual interview, I would be talking this out loud to the interviewer who's interviewing me. I would say, okay, I looks like I need to filter on this and I need to do account on these things. Now, you only would know how to do that if you know my SQL or if you know SQL, right? Again, they really want to hear your thought process. And so walking through it exactly how I did in the actual interview is exactly what the interviewer wants to hear. Now, writing it correctly is still very important, especially as you get to the more difficult questions, right? You want to know certain functions and certain ways to write things, but you should be talking all this out loud during your interview. Now, one other really cool thing I'm just going to show you this at the end is if I go over to my profile, I'm actually earning points for these questions. So right down here, I just earned a couple extra points towards my SQL badge. And I can go all the way up to expert and then master as well. And so I am well on my way. And then in future videos, when we do the medium and the hard and then the very hard questions, we earn even more points for those because they are more difficult. And they go towards these badges. So that is how we solve those easy SQL technical interview questions on Analyst Builder. Go ahead and try those out. There's tons of other free questions on the platform that you can just try out. And there's lots of easy ones, but then we're also going to be taking a look at medium, hard and very hard in future lessons. With that being said, I hope you enjoyed this video. If you did, be sure to like and subscribe below and I will see you in the next video.