PhpMyAdmin adds WHERE 1 to every statement by default

Just a curiosity question. Why phpMyadmin adds WHERE 1 to every statement in the SQL query input box?

For example,



When generating dynamic queries, it's easier to always have a WHERE clause than to have an algorithm to remove it when it's not needed. All that WHERE 1 means is 'everything' and phpMyAdmin will not append it if you put a WHERE clause in your own query.

phpMyAdmin probably creates its queries by concatenating strings, so it'll generate say $selectStatement, $whereStatement and $limitStatement and then add them all together. I don't know if it still does it, but it always used to add a LIMIT clause even when not needed as well.

It's just a simple and comprehensive way to build an SQL statement in PHP, and won't affect your query results at all.

Need Your Help

NullPointer void android.widget.LinearLayout.addView(android.view.View)

java android xml android-layout

I am making a note-taking app and i am working on saving the made notes.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.