Friday, November 22, 2013

Querying Data

Instead of adding more values I tried querying data because before the results I was getting had a lot of repeating data. I was surprised and very happy to figure out how to restrict results to just one name and one movie. Here are some scripts I made to query data.

This one restricts the search to a person's first name, Hank, and lists their name along with their ID, Title of the movie and its ID.
https://dl.dropboxusercontent.com/u/8028799/movie_query1.sql

This one restricts the search to a person's last name, Krabs, and lists their full name with only the title of the movie.
https://dl.dropboxusercontent.com/u/8028799/movie_query2.sql

This one was difficult to get working but it lists any results whose name starts with an "A" but only shows the movies they like that have an ID less than 8, but it also shows results for people with a last name that starts with "H" and any movie that ends with an "s".
https://dl.dropboxusercontent.com/u/8028799/movie_query3.sql

1 comment:

  1. Great! Here is your task for this week:

    Create a Google Form that we can use for everyone in class (and others who might be interested) to check off movies that they like. I'll help you do that.

    Then you can put the data into your three tables (with another table for "favorite movies"), and then you can run queries with real data. I'll ask Masud to help you with this.

    ReplyDelete