โ† Barclays questions
CodingMediumReported in a candidate post, Oct 2024

Filter records for the month of October

Filed under Barclays

Free read 1 of 3

Determine if the column is a string or a proper DATE/DATETIME type.

The question

Write an SQL query to select all records from a table where the date column falls within the month of October.

Constraints

  • Assume a table named 'records' with a column 'created_at' of type DATE or DATETIME.
  • The solution should be database-agnostic or specify the dialect (e.g., MySQL, PostgreSQL).

Examples

Input
Table: records (id, created_at), Row: (1, '2023-10-15')
Output
1
Why
The date falls in October, so it is selected.

Approach

  1. Determine if the column is a string or a proper DATE/DATETIME type.

Tips

  • What they are testing: Tests verify if the query correctly handles different years and boundary dates (Oct 1st vs Oct 31st).
  • Common mistake: Using LIKE '%-10-%' is inefficient as it prevents index usage and may match incorrect patterns.

Related Barclays questions

Collected from public candidate posts and coding forums. Updated Nov 2026.