Midterm 3 Solutions 12

The query should return only one row in the case

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: usiness partner has just come to you with a paradigm- shifting social- media- meets- collective- bargaining pitch: Groupon meets Instagram for Dog Owners. As a gifted database architect and rockstar ninja hacker, it’s up to you to build the site while your partner raises Series B funding. You start by setting up tables for your human users and for their dogs. A user can have multiple dogs, but dogs can have only one user. CREATE TABLE users ( userid integer, name text, age integer, PRIMARY KEY (userid)); CREATE TABLE dogs ( dogid integer, owner integer, name text, breed text, 2 age integer, PRIMARY KEY (dogid), FOREIGN KEY (owner) REFERENCES users); 5. It would be awesome to have a counter on your website keeping track of how many dog breeds are signed up for your service! On the answer sheet (not here!) mark the squares by the letters for all the queries that are guaranteed to return this number. (Zero, one, or more than one may be correct.) [2.5pt] a. SELECT COUNT(*) FROM dogs; b. SELECT COUNT(*) FROM dogs GROUP BY name; c. SELECT COUNT(name) FROM dogs; d....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online