Sue Rissberger




Simple Queries

I've come up with some extremely simple queries based on the things we discussed from the first session. SQL is new to me so the queries below reflect my desire to get a good handling on the fundamentals of the language first.

1. SELECT*FROM customer_data WHERE customer_state=NY;


I can't pull up an answer/results for this one as something is wrong in the syntax and am trying to figure it out. I'd like to just pull up all the customers where their customer state indicates NY.

2. SELECT*FROM customer_data WHERE customer_name LIKE "Vanessa%";


customer id          customer name         State

42                              Vanessa Chandler      IL

85                              Vanessa Atkinson       MA

86                              Vanessa Martin            NY

3. SELECT*FROM order_data WHERE customer_id >80 AND MONTH(datetime)>8
LIMIT 0, 3;

ANSWER:movie id          customer id             datetime

10025                     96                      2012-09-07 09:09:00

10030                     90                      2012-10-13 23:43:00

10024                     99                      2012-09-12 18:04:00

4. SELECT*FROM movie_data WHERE movie_year >2000 AND movie_title LIKE "A%";

ANSWER:movie id                  movie title                  movie price              movie year

100011                    A Beautiful Mind             $0.99                       2001

5. SELECT MIN(movie_price) AND MAX(movie_price) FROM movie_data WHERE movie_year=2010;


min(movie_price) AND max(movie_price)


--I don't think number 5 produces the correct answer


Please sign in or sign up to comment.