Update a Single Column in a Database Table
📖 Scenario: You manage a small bookstore database. One of the books has a wrong price, and you need to fix it.
🎯 Goal: Update the price of a specific book in the books table using an UPDATE statement that changes only the price column.
📋 What You'll Learn
Create a table called
books with columns id, title, and price.Insert three books with given ids, titles, and prices.
Set a variable for the new price value.
Write an
UPDATE query to change the price of the book with id = 2 to the new price.Ensure only the
price column is updated.💡 Why This Matters
🌍 Real World
Updating prices or details of products in a store database is a common task in retail and e-commerce.
💼 Career
Database administrators and developers often need to update records safely and correctly using SQL UPDATE statements.
Progress0 / 4 steps