Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS110 Database Questions. IDNAMEBIRTH YEARBIRTH MONTHHAIR COLOR 1Alice1991MarchBrunette 2Bob1982DecemberBrunette 3Carl1973AugustBlonde 4Daniella1960MayBlack.

Similar presentations


Presentation on theme: "CS110 Database Questions. IDNAMEBIRTH YEARBIRTH MONTHHAIR COLOR 1Alice1991MarchBrunette 2Bob1982DecemberBrunette 3Carl1973AugustBlonde 4Daniella1960MayBlack."— Presentation transcript:

1 CS110 Database Questions

2 IDNAMEBIRTH YEARBIRTH MONTHHAIR COLOR 1Alice1991MarchBrunette 2Bob1982DecemberBrunette 3Carl1973AugustBlonde 4Daniella1960MayBlack 5Edward2001SeptemberWhite Given the database file above, provide the IDs of the records that match the following queries (write “none” if no records match) : 1)Name is “Bob” 2)Birth Year is less than 1980 3)Hair Color is “Brunette” 4)Birth Year is less than 1980 or Hair Color is “Brunette” 5)Birth Year is less than 1980 or Name is “Bob” 6)Birth Year is less than 1980 and Name is “Bob”

3 IDNAMEBIRTH YEARBIRTH MONTHHAIR COLOR 1Alice1991MarchBrunette 2Bob1982DecemberBrunette 3Carl1973AugustBlonde 4Daniella1960MayBlack 5Edward2001SeptemberWhite Given the database file above, provide the IDs of the records that match the following queries (write “none” if no records match) : 1)Name is “Bob” 2 2)Birth Year is less than 1980 3,4 3)Hair Color is “Brunette” 1,2 4)Birth Year is less than 1980 or Hair Color is “Brunette” 1,2,3,4 5)Birth Year is less than 1980 or Name is “Bob” 2,3,4 6)Birth Year is less than 1980 and Name is “Bob” none

4 IDNAMEBIRTH YEARBIRTH MONTHHAIR COLOR 1Alice1991MarchBrunette 2Bob1982DecemberBrunette 3Carl1973AugustBlonde 4Daniella1960MayBlack 5Edward2001SeptemberWhite Given the database file above, provide the IDs of the records that match the following queries (write “none” if no records match): 7)Hair Color is not “Black” 8)Birth Year is less than 1980 and Hair Color is not “Black” 9)Birth Year is less than 1980 or Hair Color is not “Black” 10)Birth Year is less than 1980 or Birth Year is greater than or equal to 1980 11)Birth Year is less than 1980 and Birth Year is greater than or equal to 1980 12)Birth Year is greater than or equal to 1980 and Name is “Bob”, or Name is not “Daniella” and Hair Color is “White”

5 IDNAMEBIRTH YEARBIRTH MONTHHAIR COLOR 1Alice1991MarchBrunette 2Bob1982DecemberBrunette 3Carl1973AugustBlonde 4Daniella1960MayBlack 5Edward2001SeptemberWhite Given the database file above, provide the IDs of the records that match the following queries (write “none” if no records match): 7)Hair Color is not “Black” 1,2,3,5 8)Birth Year is less than 1980 and Hair Color is not “Black” 3 9)Birth Year is less than 1980 or Hair Color is not “Black” 1,2,3,4,5 10)Birth Year is less than 1980 or Birth Year is greater than or equal to 1980 1,2,3,4,5 11)Birth Year is less than 1980 and Birth Year is greater than or equal to 1980 none 12)Birth Year is greater than or equal to 1980 and Name is “Bob”, or Name is not “Daniella” and Hair Color is “White” 2,5

6 IDNAMEBIRTH YEARBIRTH MONTHHAIR COLOR 1Alice1991MarchBrunette 2Bob1982DecemberBrunette 3Carl1973AugustBlonde 4Daniella1960MayBlack 5Edward2001SeptemberWhite Given the database file above, provide the IDs of the records that match the following queries (write “none” if no records match): 13)People with brunette hair or called Alice 14)Brunettes named Carl or Edward 15)People with a birth year before 1980 and born in August or September 16)People who are not named Carl, Daniella or Edward, but are brunette or blonde 17)People born before 2000 in March or May with brunette or white hair 18)Brunettes born in January or December plus Blondes born in May or August

7 IDNAMEBIRTH YEARBIRTH MONTHHAIR COLOR 1Alice1991MarchBrunette 2Bob1982DecemberBrunette 3Carl1973AugustBlonde 4Daniella1960MayBlack 5Edward2001SeptemberWhite Given the database file above, provide the IDs of the records that match the following queries (write “none” if no records match): 13)People with brunette hair or called Alice 1, 2 14)Brunettes named Carl or Edward none 15)People with a birth year before 1980 and born in August or September 3 16)People who are not named Carl, Daniella or Edward, but are brunette or blonde 1,2 17)People born before 2000 in March or May with brunette or white hair 1 18)Brunettes born in January or December plus Blondes born in May or August 2,3

8 IDNAMEBIRTH YEARBIRTH MONTHHAIR COLOR 1Alice1991MarchBrunette 2Bob1982DecemberBrunette 3Carl1973AugustBlonde 4Daniella1960MayBlack 5Edward2001SeptemberWhite What will be the ID in the second row (excluding headers) under the following sorts? 1)Primary: Name Descending 2)Primary: Birth Year Ascending 3)Primary: Birth Year Ascending, Secondary: Name Descending 4)Primary: Hair Color Ascending, Secondary: Name Ascending 5)Primary: Hair Color Descending, Secondary: Name Ascending 6)Primary: Hair Color Descending, Secondary: Birth Year Ascending

9 IDNAMEBIRTH YEARBIRTH MONTHHAIR COLOR 1Alice1991MarchBrunette 2Bob1982DecemberBrunette 3Carl1973AugustBlonde 4Daniella1960MayBlack 5Edward2001SeptemberWhite What will be the ID in the second row (excluding headers) under the following sorts? 1)Primary: Name Descending 4 2)Primary: Birth Year Ascending 3 3)Primary: Birth Year Ascending, Secondary: Name Descending 3 (note secondary key does nothing here) 4)Primary: Hair Color Ascending, Secondary: Name Ascending 3 5)Primary: Hair Color Descending, Secondary: Name Ascending 1 6)Primary: Hair Color Descending, Secondary: Birth Year Ascending 2


Download ppt "CS110 Database Questions. IDNAMEBIRTH YEARBIRTH MONTHHAIR COLOR 1Alice1991MarchBrunette 2Bob1982DecemberBrunette 3Carl1973AugustBlonde 4Daniella1960MayBlack."

Similar presentations


Ads by Google