Databases Reference
In-Depth Information
Entering SQL Commands
This chapter explains how we can enter our own SQL commands (queries) into
phpMyAdmin and how we can keep a history of those queries.
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 .
For a default query to appear in this box, we can set it with the $cfg['DefaultQu
eryDatabase'] configuration directive, which is empty by default. We could put
a query like SHOW TABLES FROM %d in this directive. The %d parameter in this query
would be replaced by the current database name, resulting in SHOW TABLES FROM
'dbbook' in the query box.
Search WWH ::




Custom Search