Find open incidents with high impact and high urgency

Quick Overview

Write a SQL query that returns every incident with high impact, high urgency and a status of New or In Progress, sorted by creation time with a tie-breaker. It tests multi-condition WHERE filters, matching a column against a list of values, and deterministic ordering.

Find open incidents with high impact and high urgency

Company: ServiceNow

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

The `incidents` table logs IT service incidents. Find all incidents with `impact` High, `urgency` High, and `status` New or In Progress. Return `incident_id`, `title`, `impact`, `urgency`, `status`, `created_at`, ordered by `created_at` ascending, then `incident_id` ascending. ### Input Table(s) `incidents` | Column | Type | Meaning | | --- | --- | --- | | incident_id | INT | Incident identifier (primary key) | | title | VARCHAR(255) | Short description of the incident, not null | | impact | VARCHAR(50) | One of 'High', 'Medium', 'Low', not null | | urgency | VARCHAR(50) | One of 'High', 'Medium', 'Low', not null | | status | VARCHAR(50) | One of 'New', 'In Progress', 'Resolved', 'Closed', not null | | created_at | TIMESTAMP | When the incident was opened, not null | Primary key: `incident_id`. ### Output Contract - Columns, in this order: `incident_id`, `title`, `impact`, `urgency`, `status`, `created_at`. - One row per matching incident. - Sort by `created_at` ascending, then `incident_id` ascending. - No rounding or formatting; return the stored values. ### Example `incidents` | incident_id | title | impact | urgency | status | created_at | | --- | --- | --- | --- | --- | --- | | 1 | VPN gateway down | High | High | New | 2024-03-01 09:15:00 | | 2 | Email delivery delays | High | Medium | New | 2024-03-01 08:00:00 | | 3 | Payroll portal errors | High | High | In Progress | 2024-03-01 07:30:00 | | 4 | Printer offline | Low | Low | New | 2024-03-02 10:00:00 | | 5 | Database failover | High | High | Resolved | 2024-02-28 22:00:00 | | 6 | SSO login failures | High | High | New | 2024-03-01 09:15:00 | Expected result: | incident_id | title | impact | urgency | status | created_at | | --- | --- | --- | --- | --- | --- | | 3 | Payroll portal errors | High | High | In Progress | 2024-03-01 07:30:00 | | 1 | VPN gateway down | High | High | New | 2024-03-01 09:15:00 | | 6 | SSO login failures | High | High | New | 2024-03-01 09:15:00 | Incident 2 fails on urgency, incident 4 fails on impact and urgency, and incident 5 is already resolved. Incidents 1 and 6 were opened at the same moment, so `incident_id` decides their order. ### Constraints and Clarifications - The table has at most 10,000 rows, and `incident_id` is unique. - Every column is NOT NULL, so no NULL handling is needed. - `impact`, `urgency` and `status` hold exactly the values listed above, with that capitalization and spacing. - Several incidents can share a `created_at` value; the secondary sort on `incident_id` makes the order unique. ```hint Combining conditions If you express the two statuses with OR, check how it binds next to the AND conditions. ```

Overview: Write a SQL query that returns every incident with high impact, high urgency and a status of New or In Progress, sorted by creation time with a tie-breaker. It tests multi-condition WHERE filters, matching a column against a list of values, and deterministic ordering.

ServiceNow logo
ServiceNow
Nov 25, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

The incidents table logs IT service incidents. Find all incidents with impact High, urgency High, and status New or In Progress. Return incident_id, title, impact, urgency, status, created_at, ordered by created_at ascending, then incident_id ascending.

Input Table(s)

incidents

ColumnTypeMeaning
incident_idINTIncident identifier (primary key)
titleVARCHAR(255)Short description of the incident, not null
impactVARCHAR(50)One of 'High', 'Medium', 'Low', not null
urgencyVARCHAR(50)One of 'High', 'Medium', 'Low', not null
statusVARCHAR(50)One of 'New', 'In Progress', 'Resolved', 'Closed', not null
created_atTIMESTAMPWhen the incident was opened, not null

Primary key: incident_id.

Output Contract

  • Columns, in this order: incident_id , title , impact , urgency , status , created_at .
  • One row per matching incident.
  • Sort by created_at ascending, then incident_id ascending.
  • No rounding or formatting; return the stored values.

Example

incidents

incident_idtitleimpacturgencystatuscreated_at
1VPN gateway downHighHighNew2024-03-01 09:15:00
2Email delivery delaysHighMediumNew2024-03-01 08:00:00
3Payroll portal errorsHighHighIn Progress2024-03-01 07:30:00
4Printer offlineLowLowNew2024-03-02 10:00:00
5Database failoverHighHighResolved2024-02-28 22:00:00
6SSO login failuresHighHighNew2024-03-01 09:15:00

Expected result:

incident_idtitleimpacturgencystatuscreated_at
3Payroll portal errorsHighHighIn Progress2024-03-01 07:30:00
1VPN gateway downHighHighNew2024-03-01 09:15:00
6SSO login failuresHighHighNew2024-03-01 09:15:00

Incident 2 fails on urgency, incident 4 fails on impact and urgency, and incident 5 is already resolved. Incidents 1 and 6 were opened at the same moment, so incident_id decides their order.

Constraints and Clarifications

  • The table has at most 10,000 rows, and incident_id is unique.
  • Every column is NOT NULL, so no NULL handling is needed.
  • impact , urgency and status hold exactly the values listed above, with that capitalization and spacing.
  • Several incidents can share a created_at value; the secondary sort on incident_id makes the order unique.