Oops 8 how many rows are returned by r x r for a

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t DESC 3 LIMIT 1; e. SELECT userid, COUNT(*) as cnt FROM dogs LEFT OUTER JOIN users ON userid = dogid GROUP BY userid; d (a) and (e) equate people with dogs. (b) and (c) try to find the maximum dogid. 7. To further improve the user experience, you decide to create another table to store photos of dogs (stored as type ‘bytea’): CREATE TABLE photos ( dogid integer, photo bytea NOT NULL, -- constraint: cannot store NULL in this field of this table FOREIGN KEY (userid) REFERENCES users FOREIGN KEY (dogid) REFERENCES dogs ); Your partner absolutely adores greyhounds, so he wants to find out which users own greyhounds and haven’t yet added a photo of their dog. Assume the greyhound breed is represented as “greyhound”. Which SQL query answers his query? Unlike the previous query, there is exactly one correct answer to this question. Given the choices (a)- (e) below, mark all correc...
View Full Document

This note was uploaded on 01/24/2014 for the course CS 186 taught by Professor Staff during the Fall '08 term at University of California, Berkeley.

Ask a homework question - tutors are online