Record Movie Data Challenge

MySQLBeginner
Practice Now

Introduction

A local cinema needs help setting up their movie database. As their database administrator, you need to insert some movie data into their existing database. This challenge tests your ability to insert data into a MySQL table using proper SQL syntax.

Insert Movie Records

The cinema needs you to add their current movie lineup to the database. You will practice inserting multiple rows of data into a MySQL table.

Tasks

  • Connect to MySQL as the root user
  • Use the cinema database
  • Insert the following three movies into the movies table:
    1. Avatar (2009) - Science Fiction - $12.99
    2. The Dark Knight (2008) - Action - $11.99
    3. Inception (2010) - Science Fiction - $12.99

Requirements

  • All operations must be performed in the ~/project directory
  • Use the correct SQL INSERT syntax
  • All movies must be inserted in a single SQL statement
  • The title and price fields cannot be NULL
  • Years must be inserted as numbers, not strings
  • Insert the data in the exact order specified in Tasks

Example

After inserting the data correctly, running SELECT * FROM movies; should show:

+----+-----------------+--------------+-----------------+-------+
| id | title           | release_year | genre           | price |
+----+-----------------+--------------+-----------------+-------+
|  1 | Avatar          |         2009 | Science Fiction | 12.99 |
|  2 | The Dark Knight |         2008 | Action          | 11.99 |
|  3 | Inception       |         2010 | Science Fiction | 12.99 |
+----+-----------------+--------------+-----------------+-------+
✨ Check Solution and Practice

Summary

In this challenge, you practiced inserting multiple rows of data into a MySQL table. The skills demonstrated include connecting to a MySQL database, using proper SQL INSERT syntax for multiple records, handling different data types correctly, and ensuring data accuracy. These fundamental data insertion skills are essential for database management and will be used frequently when working with MySQL databases.