Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL for Expiring Provider Credentials
00:00
5 left

SQL for Expiring Provider Credentials

EasySQL · PostgreSQL

Problem

How would you write a SQL query to identify all providers whose credentials expire within the next 30 days?

Use the providers table and evaluate the date range relative to the current date. Include credentials expiring today and on the 30th day from today, but exclude expired credentials and rows without an expiration date.

Output

  1. One row per qualifying provider
  2. Columns: provider_id, provider_name, and credential_expiration_date
  3. Order by expiration date ascending, then provider name ascending

Schema

providers
ColumnTypeDescription
provider_idPKINTUnique provider identifier
provider_nameVARCHAR(100)Provider's full name
credential_expiration_dateDATEDate the provider credential expires
Tablesproviders
Interviewer

Your question is SQL for Expiring Provider Credentials. Start with the requirements and the one table in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.