Task 1: Create a Games Database
Create a new database called games_app and create a table called games with these fields:
id(INT, PRIMARY KEY, AUTO_INCREMENT)title(VARCHAR(200))genre(VARCHAR(100))release_year(INT)rating(FLOAT)
Remember to select your database in the DB dropdown after creating it.
After creating your database and table, verify your work:
- Use
SHOW DATABASES;to confirm your database exists - Use
SHOW TABLES;to confirm your table exists - Use
DESCRIBE games;to check your table structure is correct
Task 2: Add Sample Data
Insert at least 8 games into your table with different titles, genres, years, and ratings. Use ratings between 1.0 and 10.0.
Sample ideas: “The Legend of Zelda” (Action/Adventure), “Minecraft” (Sandbox), “Final Fantasy” (RPG), “FIFA” (Sports), “Call of Duty” (FPS)
You can insert multiple games efficiently using a single INSERT statement with multiple VALUES, like you learned in the lesson:
INSERT INTO games (title, genre, release_year, rating) VALUES
('Game 1', 'Genre 1', 2020, 8.5),
('Game 2', 'Genre 2', 2021, 9.0),
('Game 3', 'Genre 3', 2019, 7.2);
After inserting, run SELECT * FROM games; to confirm your data.
Task 3: Practice Queries
Write SQL queries to:
- Find all games released after 2015 (use WHERE with >)
- Sort games by rating, highest first (use ORDER BY DESC)
- Find all games where genre is ‘RPG’ (use WHERE with =)
- Show only the top 3 highest-rated games (combine ORDER BY DESC with LIMIT)
Check your results make sense - for example, question 4 should show exactly 3 games.
Task 4: Delete Data
Practice removing data from your games table.
Always check your WHERE clause before running DELETE to make sure you’re deleting the right row. There is no undo.
- Find the lowest-rated game (use ORDER BY and LIMIT)
- Delete that game using its id (use DELETE with WHERE)
- Check your table to see the changes
Task 5: Update Data
Practice modifying existing data in your games table.
- Choose any game and update its rating to 9.5 (use UPDATE with WHERE)
- Update another game’s genre to something different (use UPDATE with WHERE)
- Check your table to see the changes