Question: SQL JAVA . Write a text - based, Java program. Everything will be done in Java: creating and dropping tables, inserting, deleting and updating tables.

SQL JAVA . Write a text-based, Java program. Everything will be done in Java: creating and dropping tables, inserting, deleting and updating
tables. You will be working by yourself to come up with your own database that contains 2 tables, a parent table and a child table,
such as Party and Candidate (Should be a one to many relationship). DO NOT USE Party and Candidate or Person and Personality as your tables. Come up with your own. At the end of your program, be sure to drop your tables, which means that every time you run your program, you will be creating the tables.
Modularize your code. Your methods should not contain more than 20 lines.
Display a menu that allows the user to insert, delete, update or view all the records. 1) Insert
2) Delete
3) Update
4) View
5) Quit
1) Insert--- upon choosing insert, ask the user a series of questions that map the response to the different columns in your tables.
Lets take the Candidate and the Party tables as an example. With candidate name, james and political party, republican, you would have to create an entry in the party table if a record does not exist for the republican party and a corresponding record in the candidate table for James. You would have to make sure that the foreign keys and primary keys are assigned properly. You can use sequences to generate your primary keys.
2) Delete You would ask for some kind of unique information that identifies a record in the child table and then delete the record.
If there are no other instances of the foreign key, then also delete the record from the parent table. For example, if we look up james
and he is the only republican, then we would delete both john from the candidate table and republican from the party table.
3) Update You would ask for some kind of unique information that identifies a record in the parent table (must be unique) and then ask what the information should be changed to such as What party do you want to change? Republican
What do you want to change it to? Conservative
4) View Display all the records in the child table and their corresponding information from the parent table. Make sure to not include the primary and foreign keys. Here is a sample
James Republican
Jack Democrat
Joe Independent
6) Quit End the program
A single word document that contains the following:
1) An ER diagram of your 2 tables
2) screenshots of a sample run which tests: 2 inserts, 2 deletes, 1 update, 1 view

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!