0
0
SQLquery~30 mins

INSERT INTO multiple rows in SQL - Mini Project: Build & Apply

Choose your learning style9 modes available
Insert Multiple Rows into a Database Table
📖 Scenario: You are managing a small bookstore database. You need to add several new books to the books table at once to keep the inventory updated.
🎯 Goal: Learn how to insert multiple rows into the books table using a single INSERT INTO statement.
📋 What You'll Learn
Create a table called books with columns id (integer), title (text), and author (text).
Insert multiple rows into the books table in one INSERT INTO statement.
Use exact values for the books as specified in the instructions.
💡 Why This Matters
🌍 Real World
In real bookstores or libraries, adding multiple new books to the database at once saves time and keeps inventory accurate.
💼 Career
Database administrators and developers often insert multiple records efficiently to maintain data integrity and performance.
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, title as text, and author as text.
SQL
Need a hint?

Use CREATE TABLE books (id INTEGER, title TEXT, author TEXT); to create the table.

2
Prepare to insert multiple rows
Write a SQL statement that starts an INSERT INTO command for the books table specifying the columns id, title, and author. Do not add the values yet.
SQL
Need a hint?

Use INSERT INTO books (id, title, author) to specify the table and columns.

3
Insert multiple rows with values
Complete the INSERT INTO statement by adding VALUES with three rows: (1, 'The Hobbit', 'J.R.R. Tolkien'), (2, '1984', 'George Orwell'), and (3, 'To Kill a Mockingbird', 'Harper Lee').
SQL
Need a hint?

Use VALUES (1, 'The Hobbit', 'J.R.R. Tolkien'), (2, '1984', 'George Orwell'), (3, 'To Kill a Mockingbird', 'Harper Lee'); to insert multiple rows.

4
Verify the insertion with a SELECT statement
Add a SQL statement to select all columns from the books table to check that the rows were inserted correctly.
SQL
Need a hint?

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