LAB: Operations for CHAPLAIN Database 

Lab today (and next week) will focus on using PHP to manipulate an SQL database.
Officially, this week is on PHP and not HTML.
However, next week we will do matching HTML.
So it is OK to treat it as a two week lab.

Create SQL code for a draft set of entity and relationship tables for the clergy example below.

Consider the list of operations you might need for the database.
For the Chaplin database, you might wish to:
Add a congregation
Add a denomination
Add a clergy
Assign a congregation to a denomination
Assign a clergy to a congregation
Remove a congregation
Remove a denomination
Remove a clergy
Have a congregation leave a denomination
Remove a clergy from a congregation

FIRST create a Chaplin database.
(Suggested table headings are on the last page.)
For each operation, FIRST design SQL code to accomplish the task.
Try it out on your Chaplin database. 

Then, for each operation, write *.php code to accomplish the operation.
Make sure it works by calling it with appropriate parameters.
(That is, use ‘?’ and ‘&’ to simulate a form calling your *.php code.)

Finally, write *.htm code to get the parameters via a form.
Make sure it works by testing it.
(You do not have to do the html code until next week.)

RECOMMENDED: Add ONE FUNCTION at a time:
For example, 
write and test SQL to add a congregation to your database.
THEN write and test PHP code to add a congregation to your database.
THEN write HTML code with a form to call the PHP code.
Make sure the congregation adding works before you go on to add a denomination.

It is fine to create the database on your personal computer or on a lab computer, as long as you have the code to create the database in a file. However, *.php code can only be executed on a server.
You may use the Lemuria server, or any other server, as long as the code is accessible to Tookey.

It is possible that we will spend two weeks on this lab.
At a MINIMUM complete and test the MySQL code to do as many operations as you can.
If you wish, you may use church.html (available on Canvas) as a skeleton main page for your web site.

clergyTable 
P-ID, clergyName, clergyPhone, clergyEmail 
congregationTable 
C-ID, congregationName, worshipTimes, address 
denominationTable
D-ID, denominationName 
PART 
congregationID, denominationID 
preachTable 
clergyID, congregationID

BOLD indicates an attribute of the KEY.
Remember, if you know the KEY, you uniquely determine every attribute in the row.