-
October 10th, 2020, 01:05 PM
#1
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.
-
October 10th, 2020, 04:12 PM
#2
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.
-
October 15th, 2020, 09:23 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|