Book Image

Mastering phpMyAdmin 2.11 for Effective MySQL Management

Book Image

Mastering phpMyAdmin 2.11 for Effective MySQL Management

Overview of this book

Table of Contents (25 chapters)
Mastering phpMyAdmin 2.11 for Effective MySQL Management
Credits
About the Author
About the Reviewers
Preface

The SQL Query Box


phpMyAdmin allows us to accomplish many database operations via its graphical interface, but sometimes we have to rely on SQL query input to achieve complex operations. Here are examples of complex queries:

SELECT department, AVG(salary) FROM employees GROUP by department HAVING years_experience > 10; SELECT FROM_DAYS(TO_DAYS(CURDATE()) +30);

The query box is available from a number of places within phpMyAdmin.

The Database View

We encounter our first query box when going to the SQL menu available in the Database view.

This box is simple: we type in it some valid (hopefully) MySQL statement and click Go. Usually, we don't have to change the standard SQL delimiter, which is a semicolon, but a Delimiter dialog exists in case we need to—this is covered in Chapter 18.

For a default query to appear in this box, we can set it with the $cfg['DefaultQueryDatabase'] configuration directive, which is empty by default. We could put a query like SHOW TABLES FROM %d in this directive...