SQL
From How2s
| Table of contents |
[edit]
List databases
show databases;
[edit]
List tables of database 'wikidb'
show tables from wikidb;
[edit]
List index of table 'user' in database 'mysql'
show index from user from mysql;
[edit]
show contents of table 'user' in database 'mysql'
select * from mysql.user;
or, alternatively:
use mysql; select * from user;
[edit]
Non-Aggregates in the result set
If you need non-aggregates in the result set, it can be a real pain. Use max, min etc. to get nice workarounds. Example
select first 30 w.owner, u.gender max(w.created) from weblog w, usercore u where w.owner=u.nick \ group by w.owner, u.gender order by max(w.created) desc
(Firebird/Interbase SQL syntax!) This shows a list with 30 entries of all the users that have AT LEAST ONE weblog post done recently.

