Giter Site home page Giter Site logo

denormal-automotives's Introduction

Denormal Automotives

DB Modeling Exercise in PostgreSQL

When connecting to your pg database, connect from this project directory.

To run sql statements from an external file, use the \i [filepath] command.

Denormal Cars

Write your queries in denormal_cars.sql when instructed to.

  1. Create a new postgres user named denormal_user.
  2. Create a new database named denormal_cars owned by denormal_user.
  3. Run the provided scripts/denormal_data.sql script on the denormal_cars database.
  4. Inspect the table named car_models by running \dS and look at the data using some SELECT statements.
  5. In denormal_cars.sql Create a query to get a list of all make_title values in the car_models table. Without any duplicate rows, this should have 71 results.
  6. In denormal_cars.sql Create a query to list all model_title values where the make_code is 'VOLKS'. Without any duplicate rows, this should have 27 results.
  7. In denormal_cars.sql Create a query to list all make_code, model_code, model_title, and year from car_models where the make_code is 'LAM', Without any duplicate rows, this should have 136 rows.
  8. In denormal_cars.sql Create a query to list all fields from all car_models in years between 2010 and 2015. Without any duplicate rows, this should have 7884 rows.

Modeling a Normalized Schema

Write your queries in normal_cars.sql when instructed to.

  1. Create a new postgres user named normal_user.
  2. Create a new database named normal_cars owned by normal_user.
  3. Run the provided scripts/denormal_data.sql script on the normal_cars database.
  4. Whiteboard your solution to normalizing the denormal_cars schema.
  5. [bonus] Generate a diagram (somehow) in .png (or other) format, that of your normalized cars schema. (save and commit to this repo).
  6. In normal_cars.sql Create a query to generate the tables needed to accomplish your normalized schema, including any primary and foreign key constraints. Logical renaming of columns is allowed.
  7. Using the resources that you now possess, In normal_cars.sql Create queries to insert all of the data that was in the car_models table, into the new normalized tables of the normal_cars database.
  8. In normal_cars.sql Create a query to get a list of all make_title values in the car_models table. Without any duplicate rows, this should have 71 results.
  9. In normal_cars.sql Create a query to list all model_title values where the make_code is 'VOLKS' Without any duplicate rows, this should have 27 results.
  10. In normal_cars.sql Create a query to list all make_code, model_code, model_title, and year from car_models where the make_code is 'LAM'. Without any duplicate rows, this should have 136 rows.
  11. In normal_cars.sql Create a query to list all fields from all car_models in years between 2010 and 2015. Without any duplicate rows, this should have 7884 rows.

denormal-automotives's People

Contributors

joekarlsson avatar kasona avatar nakaz avatar sgnl avatar taesup avatar theremix avatar

Watchers

 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.