locked
SQL Microsoft Access Question RRS feed

  • Question

  • PLEASE HELP! I’m working on an Microsoft access assignment and it

    First question says “List First Name and Last name for the patients who visited the health facility more than two times” what exactly do I type in the SQL View

    Second question says "Get the patient numbers and birthdays of patients who are three years older than the youngest patient in all" What exactly do I type in the SQL View

    Third Question says"Get the invoice id, paid status and amount of those unpaid invoices whose amount is greater than the average invoice amount. Also display first name and last name of the patients associated with the invoice" What exactly do I type in the SQL View

    Sunday, July 28, 2019 9:28 PM

All replies

  • You are asking us to do your assignment for you.  That is not what we are here for.  The assignment is intended to test your understanding of how to write queries in SQL, not ours.  Nor would giving you the exact SQL as you request be doing you any favours, as merely copying what we tell you would not further your understanding of the logical basis behind writing queries.

    Nevertheless here are a few clues to get you started:

    1.  You will need a HAVING clause in the query to restrict the result table, and the HAVING clause will make use of the COUNT aggregation operator.

    2.  You will need to restrict the query by means of a subquery which returns the date of birth of the youngest patient.  Which aggregation operator do you think would be used in the subquery to return the youngest patient's date of birth?

    3.  Again you will need a subquery to restrict the query's result table.  Which aggregation operator do you think would be used in the subquery in this case?  That should be easy to decide.

    Ken Sheridan, Stafford, England


    • Edited by Ken Sheridan Sunday, July 28, 2019 10:34 PM Typo corrected.
    Sunday, July 28, 2019 10:30 PM