Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8978491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:37:36+00:00 2026-06-15T19:37:36+00:00

I have a date of birth DATE column in a customer table with ~13

  • 0

I have a date of birth DATE column in a customer table with ~13 million rows. I would like to query this table to find all customers who were born on a certain month and day of that month, but any year.

Can I do this by casting the date into a char and doing a subscript query on the cast, or should I create an aditional char column, update it to hold just the month and day, or create three new integer columns to hold month, day and year, respectively?

This will be a very frequently used query criteria…

EDIT:… and the table has ~13 million rows.

Can you please provide an example of your best solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:37:37+00:00Added an answer on June 15, 2026 at 7:37 pm

    If it will be frequently used, consider a ‘functional index’. Searching on that term at the Informix 11.70 InfoCentre produces a number of relevant hits.

    You can use:

    WHERE MONTH(date_col) = 12 AND DAY(date_col) = 25;
    

    You can also play games such as:

    WHERE MONTH(date_col) * 100 + DAY(date_col) = 1225;
    

    This might be more suitable for a functional index, but isn’t as clear for everyday use. You could easily write a stored procedure too:

    Note that in the absence of a functional index, invoking functions on a column in the criterion means that an index is unlikely to be used.

    CREATE FUNCTION mmdd(date_val DATE DEFAULT TODAY) RETURNING SMALLINT AS mmdd;
        RETURN MONTH(date_val) * 100 + DAY(date_val);
    END FUNCTION;
    

    And use it as:

    WHERE mmdd(date_col) = 1225;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table, tblClient , which stored a client's date of birth in
I have a table users with a column date_of_birth (DATE format with day, month,
I have a BirthDate column in MySQL database table to store user's date of
I want to create a table that has a birthday date, this column shouldn't
I have searched and tried many methods to format a Date of Birth column
I have a form that allows users to enter a date of birth: ie:
I have date 2012-04-02 10:01:00 am I want to show this date in with
I have date formatted in this way: 2010-02-04T00:00:00 I use this code to parse
I have a date in String format, mm/dd/yyyy I want to convert this to
I have a date field in a query and I do want to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.