Giter VIP home page Giter VIP logo

db-nerdery-challenges's Introduction

RAVN logo

Postgres logo


A project to show off your skills on databases & SQL using a real database

๐Ÿ“ Table of Contents

๐Ÿค“ Case

As a developer and expert on SQL, you were contacted by a company that needs your help to manage their database which runs on PostgreSQL. The database provided contains four entities: Employee, Office, Countries and States. The company has different headquarters in various places around the world, in turn, each headquarters has a group of employees of which it is hierarchically organized and each employee may have a supervisor. You are also provided with the following Entity Relationship Diagram (ERD)

ERD - Diagram

Comparison


๐Ÿ› ๏ธ Docker Installation

  1. Install docker

๐Ÿ“š Recover the data to your machine

Open your terminal and run the follows commands:

  1. This will create a container for postgresql:
docker run --name nerdery-container -e POSTGRES_PASSWORD=password123 -p 5432:5432 -d --rm postgres:13.0
  1. Now, we access the container:
docker exec -it -u postgres nerdery-container psql
  1. Create the database:
create database nerdery_challenge;
  1. Restore de postgres backup file
cat /.../src/dump.sql | docker exec -i nerdery-container psql -U postgres -d nerdery_challenge
  • Note: The ... mean the location where the src folder is located on your computer
  • Your data is now on your database to use for the challenge

๐Ÿ“Š Excersises

Now it's your turn to write SQL querys to achieve the following results:

  1. Count the total number of states in each country.
Your query here

result_1

  1. How many employees do not have supervisores.
Your query here

result_2

  1. List the top five offices address with the most amount of employees, order the result by country and display a column with a counter.
Your query here

result_3

  1. Three supervisors with the most amount of employees they are in charge.
Your query here

result_4

  1. How many offices are in the state of Colorado (United States).
Your query here

result_5

  1. The name of the office with its number of employees ordered in a desc.
Your query here

result_6

  1. The office with more and less employees.
Your query here

result_7

  1. Show the uuid of the employee, first_name and lastname combined, email, job_title, the name of the office they belong to, the name of the country, the name of the state and the name of the boss (boss_name)
Your query here

result_8

db-nerdery-challenges's People

Contributors

ederivero 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.