Learn the WHERE Command
Task 2: Travel to the Planet of Fun!
You need to program your rocket ship GPS to go to the Planet of Fun by rearranging the code blocks. To find the coordinates, the Galactic Federation has given you the next SQL command: WHERE!
What the command does: The WHERE command allows you to only show data that you want.
Example:
The SELECT * FROM database block that we learned from the previous activity allows us to choose a database to look through. The WHERE command allows us to narrow down what data is displayed depending on the condition (the green blocks in the image below).
A condition is a requirement you are looking for. In the first image, the database would have a column called ‘toys’ and if we only want to display the robots and the toy is labeled ‘Robot’, then the command we would use would be:
SELECT * FROM database WHERE toys = ‘robots’;
Now use what you learned to find the coordinates! You are given a database called ‘galaxy’. In the column labeled, ‘name’, you are looking for ‘Planet of Fun’.
Now that you know where the Planet of Fun is, we can find more information about it and ignore the other planets. Lets go to the Planet of Fun!