Skip to content
SQLSimplified
FreshersQuestion 24 of 50

Simulating Price Adjustments

Problem

Due to inflation, the library wants to simulate a temporary price hike of $2 on all books. Retrieve the book title, the original price, and a new column named inflated_price which is the original price plus 2.

Database Schema

Table: publishers

  • id (INT): Unique identifier for the publisher.
  • name (VARCHAR): Name of the publisher.
  • country (VARCHAR): Country of the publisher.

Table: authors

  • id (INT): Unique identifier for the author.
  • name (VARCHAR): Full name of the author.
  • country (VARCHAR): Country of origin.
  • birth_year (INT): Birth year of the author.

Table: books

  • id (INT): Unique identifier for the book.
  • title (VARCHAR): Title of the book.
  • author_id (INT): Foreign key referencing the author.
  • publisher_id (INT): Foreign key referencing the publisher.
  • published_year (INT): The year the book was published.
  • price (DECIMAL): Book price.
  • genre (VARCHAR): Genre of the book.

Try It

Loading playground environment...

Hint

Solution