Fill This Form To Receive Instant Help
Homework answers / question archive / 1) Download the file 'breeds
1) Download the file 'breeds.py'; it contains a list of lists named 'breeds'. Copy it into your interpreter; display breeds. No real work here just saving you some typing.
2. Generate a new table in dogdb named Breeds with the column names Breed, VARCHAR(20), and Description, VARCHAR(40). Then insert the data from breeds in #1 into it.
3. Query the table Breeds from dogdb and display it (i.e., as proof that it was stored).
4. generate a JOIN query to join dogs with Breeds on the Breed field, but limited to the Name, Breed, and Description fields.
5. generate a SELECT query to get dogs at least 5 years old. Display their names and ages only.
6. generate a SELECT query to get the average age (use AVG(dogs.Age) ) display it in a formatted Python statement with a label and 2 decimal places.
breeds.py:
breeds = [ ['Mutt', 'Mangy and skinny'],
['Boxer', 'Short, always looks grumpy'],
['Pekingese', 'Not really a dog'], ['Basset', 'So much skin'],
['Beagle', 'Cute-ish'], ['Irish_Setter', 'Drinks your whiskey'], ['Terrier',
'Fetch, boy'], ['Whippet', 'Whippet good'], ['Yorkie', 'Cute'], ['Gread Dane',
'So huuuge'], ['Akita', 'or is it Atika?'], ['Great Dane', 'Not that great']]
dogdb:
('Fido', 'Mutt', 15, 15)
('Odie', 'Irish_Setter', 50, 2)
('Snoopy', 'Beagle', 18, 2)
('Barfy', 'Mutt', 20, 8)
('Spot', 'Dalmatian', 25, 12)
('Hugo', 'Terrier', 28, 10)
('Lassie', 'Collie', 30, 15)
('Mangy', 'Mutt', 40, 10)
('Larry', 'Basset', 25, 4)
('Daryl', 'Retriever', 42, 8)
('Darrel', 'Chihuahua', 9, 48)
('Hotdog', 'Dachshund', 14, 14)
('Snert', 'Lab', 40, 4)
('Harpo', 'Airedale', 200, 9)
('Zeppo', 'Pekingese', 32, 5)
('Groucho', 'Whippet', 49, 7)
('Bob', 'Yorkie', 8, 1)
('Thor', 'Great Dane', 105, 6)
('Brian', 'Akita', 65, 12)
('Farkas', 'Boxer', 52, 9)
column name = ['Name', 'Breed', 'Weight', 'Age']
using python to implement sqlite3