Database Reference
In-Depth Information
use the default values. Let's see what we have now for data in the bird_families
table:
SELECT * FROM bird_families \G
*************************** 1. row ***************************
family_id: 100
scientific_name: Gaviidae
brief_description: Loons or divers are aquatic birds
found mainly in the Northern Hemisphere.
order_id: 103
*************************** 2. row ***************************
family_id: 102
scientific_name: Anatidae
brief_description: This family includes ducks, geese and swans.
order_id: 103
That's better. Notice that the server put the family name, Anatidae , in the scientif-
ic_name column, per the mapping instructions stipulated in the INSERT statement. It
also assigned a number to the family_id column. Because the family_id for the
previous row was set to 101, even though we deleted it, the server remembers elsewhere
in MySQL that the count is now at 101. So it incremented that number by 1 to set this new
row to 102. You could change the value of this row and reset the counter (i.e., the
AUTO_INCREMENT variable for the column of the table), but it's generally not important.
Let's prepare now to enter some more bird families. We'll keep the data simple this time.
We'll give only the scientific name and the order identification number. To do that, we
need to know the order_id of each order. We'll execute this SQL statement to get the
data we need:
SELECT order_id, scientific_name FROM bird_orders;
+----------+---------------------+
| order_id | scientific_name |
+----------+---------------------+
| 100 | Anseriformes |
| 101 | Galliformes |
| 102 | Charadriiformes |
| 103 | Gaviiformes |
| 104 | Podicipediformes |
| 105 | Procellariiformes |
| 106 | Sphenisciformes |
| 107 | Pelecaniformes |
| 108 | Phaethontiformes |
| 109 | Ciconiiformes |
Search WWH ::




Custom Search