DB-TASK-003

  1. Online Book Store

  • A customer can place multiple orders, but each order belongs to one customer.

  • A book can appear in multiple orders, and an order can contain multiple books.

  • Each order consists of one or more order details entries, specifying the quantity and price of each book in that order.

  • The stock quantity of a book should decrease when an order is placed.

  • A book’s price is stored at the time of the order to maintain historical pricing.

Customer Table

Book Table

Order Table

OrderDetails Table

Insert Sample Data

Insert Customers:

Insert Books:

Insert Orders:

Insert Order Details:

List all Physics and Chemistry books:

Get total stock of Physics and Chemistry books:

Find the total sales for Physics books:

  1. Library Management System

  • A member can borrow multiple books, but each loan belongs to one member.

  • A book can be loaned to multiple members over time, but only to one member at a time.

  • The return date should be recorded when the book is returned.

  1. School Management System

  • A student can enroll in multiple classrooms, and each classroom can have multiple students.

  • Each classroom is assigned one teacher.

  • A teacher can teach multiple classrooms.

  1. E-Commerce System

  • A customer can place multiple orders, and each order can have multiple products via OrderDetails.

  • A product can belong to multiple categories via ProductCategory.

  • Each order must be associated with a payment.

Last updated