CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Posts
    399

    Reduce the computation time of the queries above using indexes

    Hello. I have few SQL queries. Something like this:
    Code:
    number of patients born on Januray 1st, 2000
    number of patients born before Januray 1st, 2000
    number of patients having firstname "JOHN"
    distribution patients per birth year
    distribution of firstnames
    I have to create these queries if data structure is like this:
    Code:
    P00003542,JOHN^SMITH,19960124,M
    P00002888,BILLY^STANLEY,20050903,U
    P00006888,HRO^ELLEN,20040314,U
    What query should I do on last requests (distribution patients per birth year) ? Grouping data by birth year ?

    And I have another task then:

    Reduce the computation time of the queries above using indexes

    What should I do in this case on queries from above ?
    Last edited by mesajflaviu; October 10th, 2020 at 01:07 PM.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Reduce the computation time of the queries above using indexes

    Unless this is a homework assignment, I would import the records into a local database and let its database engine execute the queries.

  3. #3
    Join Date
    Jan 2009
    Posts
    399

    Re: Reduce the computation time of the queries above using indexes

    I create an index for that table:
    Code:
    CREATE INDEX id_index ON patients(patient_id);
    and removing index:
    Code:
    DROP INDEX id_index;

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured