MySQL Forums
Forum List  »  Newbie

Re: avoiding Long SQL statements
Posted by: Andrew Gilfrin
Date: August 01, 2005 07:03AM

"Apart from that there're some short way of writing things like instead of listing SET foo='bar' in UPDATE query you can use (bar) VALUES ('foo')."

Are you sure you can do that?

"Don't avoid using multiple queries, you can store result of first query in a string and use it on the next one or so. That way you might even increase performance with less joining tables."

I'd also disagree with that, much better to use joins than do this sort of thing in the application processing.

A query should be as long as it needs to be, if thats 100 lines long so be it. That's not to say SQL should be complicated, in many cases re-evaluating your SQL should highlight areas where things can be made more efficient.

Andrew Gilfrin
------------------
http://gilfster.blogspot.com
My MySQL related Blog

http://www.mysqldevelopment.com
MySQL Stored Procedure,Trigger, View.... (Just about most things these days) Information

Options: ReplyQuote


Subject
Written By
Posted
Re: avoiding Long SQL statements
August 01, 2005 07:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.