Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

Create the database/Setup database tables Identify a Primary Key Store the questions results each time a response is submitted

Computer Science Sep 15, 2020

Create the database/Setup database tables
Identify a Primary Key
Store the questions results each time a response is submitted.
Use INSERT statements to populate the table
Issue SELECT SQL statement(s) that request all the possible answers for the poll.
Use a WHILE loop to extract info from the MySQL result set
Use the MySQL function COUNT() to count the number of records in the table
Display the number of votes the chosen answer received.

Expert Solution

I used 3 tables. 1 table to store the possible colors, 1 table to store the possible seasons, and another to store the votes. There are an additional two attributes in that table, the sex and the marital status.

I chose to store each vote that comes in. This way we have the maximum possible ability to look at the data afterwards. If you just recorded the count of each, it doesn't tell you any relationship between color and sex for example.

The primary key for the votes table would be the the "id". There is no other possible primary key. If we took all the fields except for the "id" to be the primary (composite) key, that would not be good enough, as some people might vote for the same combination of responses, therefore that is not a unique key. So "id" is the only possible primary key here.

Please see the attached mysql initialization file as well as the php code that I have implemented and tested. It does not count the votes but it does display all the results. It should be easy to do all sorts of statistics or whatever you want. All the framework is there in the code.

By the way, in PHP, the mysql_numrows($result); does the COUNT for you.

Archived Solution
Unlocked Solution

You have full access to this solution. To save a copy with all formatting and attachments, use the button below.

Already a member? Sign In
Important Note: This solution is from our archive and has been purchased by others. Submitting it as-is may trigger plagiarism detection. Use it for reference only.

For ready-to-submit work, please order a fresh solution below.

Or get 100% fresh solution
Get Custom Quote
Secure Payment