---
title: "Lab 9: SQL and Data Scraping"
author: 'Group Member Names - here'
date: "March 22, 2018"
output: html_document
---
Turn in one copy for each group. If group members are not present in class they will be required to complete their own lab to receive credit. Then turn in an HTML and R Markdown output. This is due Tuesday March 27th at 12:15 PM.
## Q1. (40 points)
Visit the website: [http://www.montana.edu/marketing/about-msu/](http://www.montana.edu/marketing/about-msu/), your goal is to write code to extract the table that contains the Top 10 Student Home States. In this case you could likely enter this by hand quicker, but if the table was much larger scraping would be more efficient.
## Q2. (60 points)
For this question, a subset of the tables contained in the History of Baseball database are available. The sqlite database can be downloaded at [http://math.montana.edu/ahoegh/teaching/stat408/datasets/example.sqlite](http://math.montana.edu/ahoegh/teaching/stat408/datasets/example.sqlite). You will need to store this file locally on your computer. Additional details are available here: [https://www.kaggle.com/seanlahman/the-history-of-baseball](https://www.kaggle.com/seanlahman/the-history-of-baseball).
#### SQL
Select players born in the State of Montana and compute:
- the total number of players
- the total number of homeruns by these players. (This will require joining the batting and player tables).