
SQL – Importing Data, Creating a Database
For this exercise, we will be using an open source database manager called SQLite that runs as an extension to Firefox. It basically turns your browser into a database program. Firefox Add-On: https://addons.mozilla.org/en-us/firefox/addon/sqlite-manager/
Create a database
WORKING WITH FL_NATIVITY
Instructions for this exercises follow this tipsheet: MySQL_Tipsheet-rsw using this data FL_nativity
Try to create a new database (see instructions on this page) and perform some basic queries.
Homework
Updated 4/5
- Import the FL_poverty data and clean up the labels.
–You may find it easier to edit the labels on Excel first before importing them. Remember, no spaces
2) Join the Fl_nativity and FL_poverty tables in SQL. Join them on the Id2 field. Query SELECT * to show both joined, post a screenshot.
For background, first review this entry on the basic concept of joining tables:
https://www.w3schools.com/sql/sql_join_inner.asp
Documentation on the Joining Tables command.
https://dev.mysql.com/doc/refman/5.7/en/join.html
If you can’t get it to work after an hour, then write down your progress, any questions and post that for the assignment.
3) Assuming you get it to work, run a few basic queries:
From Fl_Poverty:
The top and bottom counties with the most and least number of people in poverty.
Top three counties with the highest Non-Citizen** poverty
Bonus question:
Create a new column for the native poverty rate (poverty / population) and non-citizen poverty rate. Determine the top and bottom counties in these categories.
**Updated the question Wednesday
Blog Post by 11:59 pm with the answers.
Quick Reference Sheet for these commands:
Links to SQL Tutorials
SQL Reference: https://www.w3schools.com/sql/sql_quickref.asp Tip Sheet for FL_Nativity: MySQL_Tipsheet-rsw Data types https://www.w3schools.com/sql/sql_datatypes.asp
SQL Tutorial from Matt Waite:
https://github.com/tthibo/SQL-Tutorial