reset password
Author Message
dcontr31
Posts: 6
Posted 16:35 Jan 25, 2015 |

can anybody help me with LAB 3B

venny
Posts: 61
Posted 16:37 Jan 25, 2015 |

Can you specify which problems?

dcontr31
Posts: 6
Posted 16:46 Jan 25, 2015 |

5a and 6 

304374842
Posts: 56
Posted 16:53 Jan 25, 2015 |

I am having problems with 6, too.  I can't get the searched case statement to work.

dcontr31
Posts: 6
Posted 16:57 Jan 25, 2015 |

me either but 5a i dont know how to get the code to specify to bryce sanders

304374842
Posts: 56
Posted 17:13 Jan 25, 2015 |

are you talking about where it says to specify Maxine Alvarez?

venny
Posts: 61
Posted 17:34 Jan 25, 2015 |

So with 6, you need to use the CASE WHEN statement in the list of the field names after SELECT, For one of the field names, you need to put in      

CASE WHEN <boolean expression here> THEN <what you want displayed> ELSE <if the boolean case doesn't work, then put whatever is in here instead.>  END AS <title of the column>

 

An example is if I want to say yes or no, depending if a person's name is 'Ann'.     

SELECT LastName, MemberID, CASE WHEN FirstName ="Ann" THEN "yes" ELSE "no" END AS "First Name is Ann?" FROM Members; 

 

venny
Posts: 61
Posted 17:39 Jan 25, 2015 |

for 5a, to get Bryce Sanders only, you need to use the WHERE statement and you would need to use the AND statement too.  You need to use AND because the first and last names are separated.

For example, if I wanted a member with the last name of "Smith" and is from Los Angeles, I would put.

 

SELECT FirstName,LastName FROM Members WHERE (LastName="Smith") AND (City="Los Angeles");

venny
Posts: 61
Posted 16:11 Jan 26, 2015 |

Please let me know if those were of any help.