the n steps of a query
  • Understand the question
    It may help to write down the question, especially if you have received the request second or third hand.

  • Clarify the question if it is unclear
    If there are any terms which are vague or otherwise unclear, have the original requester clarify them. For example the word "academics" may have different meanings in different contexts.

  • If you cannot clarify the question, make necessary assumptions
    If the original requester is unavailable or refuses to clarify the question, explicitly make the assumptions you feel are most appropriate. For example you might assume that academics are all persons with certain titlecodes.

    It is important to note your assumptions so that you can explain your results.

  • Determine how the conditions of the question relate to data fields in a table
    The data request will likely be English text -- you must translate this to the appropriate database field values. For example if you were asked for a list of Chinese/Chinese Americans you would need to look for ethnic_codes which were = 2. You may have to query a lookup table (ethnic_codes in this case) to determine such values.

    This step may require considerable familiarity with the database and with UCSD codes and rules. Don't hesitate to verify with an experienced co-worker that you are interpreting the codes or fields correctly.

  • Extract data
    Apply the conditions you have decided are appropriate and run the query.

  • Sanity - check the results
    Look at the results carefully and verify that they are within reason. For example a query listing current Biological Sciences AP&S employees with 546 names on the list is obviously in error.

  • Note any assumptions you have made
    If you have made any assumptions, note them in the output or in a cover letter or email.

  • Format output if necessary
    If the requester requires fancy printing or a data file format, tranlate the results into the required format.


There are a number of examples you can try. They include queries from the different functional areas of Biological Sciences: PPS, Fiscal, Student Affairs and Academic Personell.