Topfolio
Career TracksMicro Free CoursesTask CoursesPracticeInterview PracticeWork ExperienceProjects
Career TrackBlog
Support
Dashboard
Career TracksMicro Free CoursesTask Courses
SQL & Python
Interview Prep
Work ExperienceProjectsResume Feedback
CertificatesMy OrdersRefer & Earn
Join Community

Navigation

Dashboard
Learn
Career TracksMicro Free CoursesTask Courses
Practice
SQL & PythonInterview Prep
Career
Work ExperienceProjectsResume Feedback
My Stuff
CertificatesMy OrdersRefer & Earn
Join Community
Topfolio

Learn data analytics online. Real skills, real projects, real community.

courses

  • Career Tracks
  • Work Experience
  • Best Data Analyst Course in India
  • SQL Fundamentals
  • SQL Advanced
  • Python for Data
  • Micro Free Courses

practice

  • SQL Fundamentals Interview Test
  • SQL Advanced Coding Test
  • All Practice Tests

resources

  • How to Become a Data Analyst
  • SQL Interview Questions
  • Data Analyst Salary Guide
  • Free Datasets for Practice
  • SQL vs NoSQL Guide
  • Data Analyst vs Data Engineer vs Data Scientist

employers

  • Enterprise Screening
  • AI Proctoring Demo
  • Volume Pricing
  • Employer Portal

company

  • About
  • Terms
© 2026 Topfolio. All rights reserved.Made with ❤️ for aspiring analysts
Topfolio
Career TracksMicro Free CoursesTask CoursesPracticeInterview PracticeWork ExperienceProjects
Career TrackBlog
Support
Dashboard
Career TracksMicro Free CoursesTask Courses
SQL & Python
Interview Prep
Work ExperienceProjectsResume Feedback
CertificatesMy OrdersRefer & Earn
Join Community

Navigation

Dashboard
Learn
Career TracksMicro Free CoursesTask Courses
Practice
SQL & PythonInterview Prep
Career
Work ExperienceProjectsResume Feedback
My Stuff
CertificatesMy OrdersRefer & Earn
Join Community

CASE: Create Price Tiers

beginner~5 min10 pts
📊 View Insights

Problem

Use CASE expressions to categorize tracks into pricing tiers. CASE acts like if-then-else logic within SQL.

Write a query that categorizes tracks as 'Standard' ($0.99) or 'Premium' ($1.99) based on their price.

Schema: Track

ColumnType
TrackIdINTEGER (Primary Key)
NameTEXT
AlbumIdINTEGER (Foreign Key → Album.AlbumId)
MediaTypeIdINTEGER (Foreign Key)
GenreIdINTEGER (Foreign Key → Genre.GenreId)
ComposerTEXT
MillisecondsINTEGER
BytesINTEGER
UnitPriceNUMERIC(10,2)

Requirements:

  • Use CASE to create a PriceTier column
  • $0.99 = 'Standard', $1.99 = 'Premium', anything else = 'Other'
  • Return track Name, UnitPrice, and PriceTier
  • Order by UnitPrice descending (so Premium tracks appear first), then by TrackId ascending to break ties
  • Limit to the first 20 rows

CASE Syntax:

CASE
    WHEN condition1 THEN result1
    WHEN condition2 THEN result2
    ELSE default_result
END
CASE WHENConditional LogicFlipkart
📊
📊 View Question Telemetry & Insights
Failure rate, silent bug autopsy & optimal query construction
Inspect →

Master SQL & Data Analytics

Ready to take your skills to the next level? Enroll in our comprehensive Data Analyst Career Track to master SQL, Python, Excel, and Power BI.

Explore the 12-Week Data Analyst Career Track

Related questions

  • CASE: Categorize Track Lengthsbeginner
  • CASE in Aggregation: Count by Categoryintermediate
  • Month-over-Month Revenue Growth Rateadvanced
  • Customer Lifetime Value with Tier Classificationadvanced
  • Year-over-Year Genre Revenue Changeadvanced
  • Catalog Snapshot Reportintermediate
  • Regional Revenue Slice (2012–2013)intermediate
  • Customer Lifetime Value Tierintermediate
SQL Editor

Run your code to see the result here.

Topfolio

Learn data analytics online. Real skills, real projects, real community.

courses

  • Career Tracks
  • Work Experience
  • Best Data Analyst Course in India
  • SQL Fundamentals
  • SQL Advanced
  • Python for Data
  • Micro Free Courses

practice

  • SQL Fundamentals Interview Test
  • SQL Advanced Coding Test
  • All Practice Tests

resources

  • How to Become a Data Analyst
  • SQL Interview Questions
  • Data Analyst Salary Guide
  • Free Datasets for Practice
  • SQL vs NoSQL Guide
  • Data Analyst vs Data Engineer vs Data Scientist

employers

  • Enterprise Screening
  • AI Proctoring Demo
  • Volume Pricing
  • Employer Portal

company

  • About
  • Terms
© 2026 Topfolio. All rights reserved.Made with ❤️ for aspiring analysts