Loading
Lesson 25
Courses / HackerRank SQL Problem Solving Solution Challenges
Select By Id | SQL Basic Select | HackerRank Solution

Video Transcript

Hey everybody, welcome to another lesson. I will do the exercise select by ID from the basic select subsection of the SQL section from HackerRank. Let's get started. We have the stable city with the columns ID name, country code, district, and population. And we're asked to query all columns that is going to use star for the select statement. For a city with the ID 1661 that we have to filter by the ID column with the value 1661. Okay, if you want to visualize the data you can always do select star from city to see what it looks like and click run code. And as you can see this is what the data looks like each row has information about the city and as you can see the first column is the ID and that's what we want to filter by. There is one of them that has the ID 1661 that's the row we want to filter. So we're going to go here we want all columns so star and after from city we say where and we have to say ID is equal to 1661 and ID is a number so I don't need quotes here. Let's run the code. And there you go this is the row with the city of ID 1661 and that's the information for the other columns. I'm going to click submit and there you go that's select by ID.
No comments yet (loading...)
No comments yet (loading...)
Did you like the lesson? 😆👍
Consider a donation to support our work: