0
0
MySQLquery~30 mins

INSERT INTO single row in MySQL - Mini Project: Build & Apply

Choose your learning style9 modes available
Insert a Single Row into a MySQL Table
📖 Scenario: You are managing a small bookstore database. You want to add a new book to the books table.
🎯 Goal: Learn how to insert a single row into a MySQL table using the INSERT INTO statement.
📋 What You'll Learn
Create a table called books with columns id, title, and author
Add a new book entry with specific values using INSERT INTO
Use exact column names and values as instructed
💡 Why This Matters
🌍 Real World
In real life, inserting data into a database is how you add new records like books, customers, or orders.
💼 Career
Database administrators and developers frequently use INSERT statements to add data to databases in applications.
Progress0 / 4 steps
1
Create the books table
Write a SQL statement to create a table called books with three columns: id as an integer primary key, title as a VARCHAR(100), and author as a VARCHAR(100).
MySQL
Need a hint?

Use CREATE TABLE books (id INT PRIMARY KEY, title VARCHAR(100), author VARCHAR(100));

2
Prepare to insert a new book
Write a SQL statement to insert a new row into the books table with columns id, title, and author. Use the values 1 for id, 'The Great Gatsby' for title, and 'F. Scott Fitzgerald' for author.
MySQL
Need a hint?

Use INSERT INTO books (id, title, author) VALUES (1, 'The Great Gatsby', 'F. Scott Fitzgerald');

3
Verify the insertion
Write a SQL statement to select all columns from the books table to verify the new row was inserted.
MySQL
Need a hint?

Use SELECT * FROM books; to see all rows in the table.

4
Add a final comment
Add a SQL comment at the end of your code that says -- Insert complete to mark the completion of your insert operation.
MySQL
Need a hint?

Add -- Insert complete at the end of your SQL code.