Giter Club home page Giter Club logo

sql_practice's Introduction

SQL Practice

This repository contains two .sh files that will allow you to create both a SQLite and PostgreSQL database from files from the City of Chicago's open data portal.

# install necessary packages
# note: takes about 2 minutes
sh install_packages.sh

# download chicago data sets
# note: takes about 3 minutes
sh create_chicago_database.sh

Database

The create_chicago_database.sh script creates both a write_data/chicago.db and postgresql:///chicago database to be used with either SQLite or PostgreSQL.

Here is more information regarding the different tables that make up the chicago database:

Table Name Description Documentation
census_tracts_2010 2010 census tracts boundaries in Chicago, IL. https://data.cityofchicago.org/Facilities-Geographic-Boundaries/Boundaries-Census-Tracts-2010/5jrd-6zik
community_areas Current 77 Chicago community areas (CCAs). Note: these 77 CCAs are well-defined, static, and do not overlap. Census data are tied to the CCAs, and they serve as the basis for a variety of urban planning initiatives on both the local and regional levels. https://data.cityofchicago.org/Facilities-Geographic-Boundaries/Boundaries-Community-Areas-current-/cauq-8yn6
cps_dropout_rate_2011_2019 The five-year cohort dropout rate follows a group of students who enter Chicago Public Schools (CPS) high schools as freshmen and calculates the percent of these students who drop out within five years after their freshman year. This table contains the dropout rates for each school year from 2011 to 2019. Note: unfortunately, some schools have been closed since 2011. To verify if a school is closed, please check the status_as_of_2019 column. CPS Data and Source
cps_sy1819_cca School profile information for all schools in the Chicago Public School district for the school year 2018-2019. https://data.cityofchicago.org/Education/Chicago-Public-Schools-School-Profile-Information-/kh4r-387c
crimes_2019 This dataset reflects reported incidents of crime (with the exception of murders where data exists for each victim) for the year 2019. https://data.cityofchicago.org/Public-Safety/Crimes-2019/w98m-zvie
food_inspections This information is derived from inspections of restaurants and other food establishments in Chicago from January 1, 2010 to the present. Inspections are performed by staff from the Chicago Department of Public Health’s Food Protection Program using a standardized procedure. The results of the inspection are inputted into a database, then reviewed and approved by a State of Illinois Licensed Environmental Health Practitioner (LEHP). https://data.cityofchicago.org/Health-Human-Services/Food-Inspections/4ijn-s7e5/data
il_wac_s000_jt00_2017 Workplace Area Characteristic data for IL in 2017 that counts the total number of jobs for workers in all jobs by Census Block. LEHD Data & IL 2017 WAC Data
il_xwalk Geographic crosswalk data used to help aggregate census blocks up to census tracts, zip codes, counties, and states. LEHD Data & IL 2017 Geographic Crosswalk Data

Questions

  1. In the cps_dropout_rate_2011_2019 table, count how many records appear for each school_year. Note: it is helpful to include the school_year column and to order the results by it as well.

  2. Identify the schools and their community area whose dropout rate in school year 2019 is greater than or equal to 25 percent.

  3. Identify the top 10 community areas that have the highest number of crimes in 2019.

  4. Identify the top 10 community areas that have the highest number of jobs in 2017.

sql_practice's People

Contributors

cenuno avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.