Updating rows in mysql

Rated 3.92/5 based on 932 customer reviews

It has been a problem on my mind for quite some time now.

A requirement arises in many systems to update multiple SQL database rows.

Thing is, there have been no concerns about normalization as I have had no problems with data insertion, querying results, reporting the answers, association of answers with members, etc!

The only thing I am trying to solve is updating the database with one query instead of (1 to N) number of insert queries depending on how many "items" are listed.

btw, why did you make up ficticious table names and then add the explanation?

you really ought to help make it easier for poeple to try to help you.

The dominant factor in the time taken to complete the overall operation tends to be the “admin” work in conveying the application’s intention to the database server rather than the actual updates to the database.

r397 recommended to have the three rows in a normalized table, in first normal form. Now if there was a Member #1 Responses - Question #1: yes, 22, no, 34 - Question #2: no, 24, yes, 42 - Question #3: yes, 14, no, 42 Member #2 Responses - Question #1: no, 42, no, 55 - Question #2: no, 51, yes, 21 - Question #3: yes, 11, no, 14 etc., I see your concern and how you may recommend having only one answer for one question, which makes it so much easier to update SQL and PHP wise!

The problem I find with that structure is there are at the same time an variable number of questions and an variable number of answers plus multiple answers for a single individual that need to be recorded. Unfortunately, I was tasked to present the survey in the format shown in the screenshot below, which is why I chose to design the table structures the way I did.

Visit Stack Exchange Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Sign up to join this community Looking through the My SQL Update Reference, this site (My SQL - csv update), SO (update multiple rows, multiple db updates, update multiple rows), I suspect that the answer is "no", but I'd like to confirm that this is true.

Hi Site Point members I have been perusing through the solutions for "updating multiple rows with one query", but I have a pressing question: How would one "SET" multiple column values with one query?

Leave a Reply