Skip to content

Instantly share code, notes, and snippets.

@sferik
Created April 2, 2013 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sferik/5288857 to your computer and use it in GitHub Desktop.
Save sferik/5288857 to your computer and use it in GitHub Desktop.

WDI Homework - April 1, 2013

SQL

  1. Write a program that converts Roman numerals to Arabic numerals.
  2. Download this SQLite database and write a SQL statement that:
    1. Selects the names of all products that are not on sale.
    2. Selects the names of all products that cost less than $20.
    3. Selects the name and price of the most expensive product.
    4. Selects the name and price of the second most expensive product.
    5. Selects the name and price of the least expensive product.
    6. Selects the names and prices of all products, ordered by price in descending order.
    7. Selects the average price of all products.
    8. Selects the sum of the price of all products.
    9. Selects the sum of the price of all products whose prices is less than $20.
    10. Selects the id of the user with your name.
    11. Selects the names of all users whose names start with the letter "A".
    12. Selects the number of users whose first names are "Jonathan".
    13. Selects the number of users who want a "Teddy Bear".
    14. Selects the count of items on the wishlish of the user with your name.
    15. Selects the count and name of all products on the wishlist, ordered by count in descending order.
    16. Selects the count and name of all products that are not on sale on the wishlist, ordered by count in descending order.
    17. Inserts a user with the name "Jonathan Postel" into the users table. Ensure the created_at column is set to the current time.
    18. Selects the id of the user with the name "Jonathan Postel"? Ensure the created_at column is set to the current time.
    19. Inserts a wishlist entry for the user with the name "Jonathan Postel" for the product "The Ruby Programming Language".
    20. Updates the name of the "Jonathan Postel" user to be "Jon Postel".
    21. Deletes the user with the name "Jon Postel".
    22. Deletes the wishlist item for the user you just deleted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment