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 textbased, 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 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 lines.
Display a menu that allows the user to insert, delete, update or view all the records. Insert
Delete
Update
View
Quit
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.
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.
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
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
Quit End the program
A single word document that contains the following:
An ER diagram of your tables
screenshots of a sample run which tests: inserts, deletes, update, view
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
