SQL embedded in PHP
Embed the following in a PHP program. You can do multiple in one program if you want to - just be
sure it is clear what problem you are solving on the output. Note that the first group using the
donor table. The others can be a table of your choice.
- Create a query to display the unique or distinct contacts from the donor table that you just created.
- Create a query to sort by yrgoal in descending order.
- Create a query to concatenate the street address so you print stadr followed by a comma and a space and then city followed by a comma and a space and then state followed by a space and then zip.
- Create a query to sort by datefst within state.
- Create a query to display all contacts that have a Jo in their name.
- Create a query to display all names where the first name starts with letters in the J-R range. Use the BETWEEN clause.
- Create a query to display all donors that live in Providence, Seekonk or Swansea. Use the IN clause.
- Create a query to display all people that gave their first contribution in 92.
- Create a query to list all donors who have Susan Jones or John Adams as their contact person and display them in the order of name within city within state.
- Do a query and group on a field and show the sum and average as well as the count.
- Do a query where you group and eliminate a record from the group based on
your choice of criteria. You can also decide what you are showing for the group.
- Modify the query above so that you eliminate certain groups from the display.
- Do a query that involves a subquery.
- Write the code to select conditionA and conditionB or conditionC and conditionD and order the results by a specific field.