8000 GitHub - veryacademy/SQL-Challenge-0003-Scenario-A: List All Active Promotions.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

veryacademy/SQL-Challenge-0003-Scenario-A

Repository files navigation

🚀 Master SQL with Our Course!

Want to level up your SQL skills? Our SQL Fundamentals Course covers everything from basics to advanced queries.

🔥 Join the Udemy Course today and start learning!
📌 Click here to enroll now!


🚀 Challenge: List All Active Promotions

📚 Introduction

You work for an e-commerce platform that runs various promotional events. Each promotion has a start date and an end date, and your task is to list all active promotions—those where the current date is within the valid promotion period.


🎯 Challenge Specification

Write an SQL query to fetch all active promotions from the promotion_events table.

✅ Requirements:

  • Select the following columns:
    • id (Promotion ID)
    • name (Promotion Name)
    • start_date (Start Date)
    • end_date (End Date)
    • price_reduction (Discount Amount)
  • Only include promotions where the current date falls within the start_date and end_date.
  • Order the results by start_date in ascending order.

💂 Sample Data

Here’s an example of the promotion_events table (The actual data can be found in init.sql):

id name start_date end_date price_reduction
1 Spring Sale 2025-03-20 00:00:00 2025-04-05 23:59:59 20
2 Summer Deals 2025-06-01 00:00:00 2025-06-15 23:59:59 15
3 Winter Blast 2025-12-01 00:00:00 2025-12-31 23:59:59 25

🔗 Entity-Relationship Diagram (ERD)

You can view the database ERD here:

🔗 Lucidchart ERD


🤔 Try It Yourself

Write a query to return only the active promotions.


🔗 Next Steps

  1. 📌 Read the Setup Instructions to get everything up and running.
  2. 📝 Run your query.
  3. 💡 Need help? Check out the solutions.sql file.

Watch the first Challenge if you need more help getting the code started.
🔗 Link to first Challenge 001


📌 Don't Forget

You only need to set up the database once for all challenges in Scenario A (see challenge name). Each scenario uses slightly different data, tailored to match the specific challenge requirements.

About

List All Active Promotions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0