[ale] MySQL help
David S Jackson
deepbsd.ale at gmail.com
Fri Mar 13 13:52:09 EDT 2015
I'm a MySQL newbie. I'm just starting to use Python to talk to MySQL
databases, but first I need to understand the MySQL query language!
So, I have two tables: (zoo) animal and food.
animal has the columns ID, NAME, FAMILY, WEIGHT
food has ID, ANIMALID, FEED
So if I go: select id, name, family, feed from animal JOIN food ON
I get something like:
ID NAME FAMILY FEED
1 Seymore Snake mice, leaves
2 Gerard Giraffe leaves, grass
So, if I have a situation where I want to see whether an animal has been
added the animal table but may have not been added to the food table,
how would I compose that query?
That is, the animal could have been added to the animal table and could
get an id, say 10, but the food table could have 20 foods already
entered and the animal-id would be used several times.
I was thinking, is there a way I can ask, "does the highest animal.id
number equal the highest food.animalid number"? If not, what animal is
not getting fed?
More information about the Ale