Skip to content
SQLSimplified
FreshersQuestion 45 of 50

Filtering Orders by Date

Problem

The finance team is auditing orders placed in the first half of 2021. Find all order_id and amount values from the orders table where the order_date falls between '2021-01-01' and '2021-06-30'.

Database Schema

Table: customers

  • customer_id (INT): Unique identifier for the customer.
  • first_name (VARCHAR): First name.
  • last_name (VARCHAR): Last name.

Table: products

  • product_id (INT): Unique identifier for the product.
  • name (VARCHAR): Product name.
  • price (DECIMAL): Product price.
  • category (VARCHAR): Product category.

Table: orders

  • order_id (INT): Unique identifier for the order.
  • customer_id (INT): Foreign key referencing the customer.
  • order_date (DATE): Date of the order.
  • amount (DECIMAL): Total order amount.

Try It

Loading playground environment...

Hint

Solution