Databases Reference
In-Depth Information
The output looks identical to the previous example:
1 New Order
2 Nick Cave & The Bad Seeds
3 Miles Davis
4 The Rolling Stones
5 The Stone Roses
6 Kylie Minogue
You can see that the columns appear in the order they do in the table—that is, the
artist_id appears before the artist_name . Notice also that we used the
mysql_num_fields( ) function described in the previous example to figure out how
many columns there were in the results.
Suppose that you want to to run the following query that uses two tables:
SELECT * FROM artist, album WHERE artist.artist_id = album.artist_id
With the monitor, you'd get:
mysql> SELECT * FROM artist, album WHERE artist.artist_id = album.artist_id;
+-----------+---------------------------+-----------+----------+...
| artist_id | artist_name | artist_id | album_id |...
+-----------+---------------------------+-----------+----------+...
| 1 | New Order | 1 | 1 |...
| 1 | New Order | 1 | 2 |...
| 1 | New Order | 1 | 3 |...
| 1 | New Order | 1 | 4 |...
| 1 | New Order | 1 | 5 |...
| 1 | New Order | 1 | 6 |...
| 1 | New Order | 1 | 7 |...
| 2 | Nick Cave & The Bad Seeds | 2 | 1 |...
| 3 | Miles Davis | 3 | 1 |...
| 3 | Miles Davis | 3 | 2 |...
| 4 | The Rolling Stones | 4 | 1 |...
| 5 | The Stone Roses | 5 | 1 |...
| 6 | Kylie Minogue | 6 | 1 |...
+-----------+---------------------------+-----------+----------+...
...+------------------------------------------+
...| album_name |
...+------------------------------------------+
...| Retro - John McCready FAN |
...| Substance (Disc 2) |
...| Retro - Miranda Sawyer POP |
...| Retro - New Order / Bobby Gillespie LIVE |
...| Power, Corruption & Lies |
...| Substance 1987 (Disc 1) |
...| Brotherhood |
...| Let Love In |
...| Live Around The World |
...| In A Silent Way |
...| Exile On Main Street |
...| Second Coming |
...| Light Years |
...+------------------------------------------+
13 rows in set (0.01 sec)
 
Search WWH ::




Custom Search