Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Salary on a Given Date

Return each employee's salary on 2025-03-15 (start_date <= date and the date is before end_date, or end_date is NULL). Order by name.

Table schema

SalaryHistory(emp VARCHAR(10), salary INT, start_date DATE, end_date DATE)

Sample data

emp | salary | start_date | end_date
Ann | 50000 | 2024-01-01 | 2025-01-01
Ann | 60000 | 2025-01-01 | 2026-01-01
Ann | 75000 | 2026-01-01 | NULL
Bob | 40000 | 2024-06-01 | 2025-06-01
Bob | 42000 | 2025-06-01 | NULL

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.