Git Product home page Git Product logo

nba_stats's Introduction

SQL

https://media.giphy.com/media/3o6wrCyusA67uiLHYA/giphy.gif

Part 1: DB Setup

Create a database called nba_db.

createdb nba_db -U USERNAME

I've created the schema for a table called players in the file tables.sql. The schema includes an id, name, age, team, games, and points.

Run the tables.sql file for your nba_db by typingpsql -d nba_db -f tables.sql into your terminal (not in psql). This will create the players table in your nba_db.

Part 2: Fill the DB from a File

psql -d nba_db -U akira -f seed.sql

Part 3: Query your Filled DB

Figure out the appropriate SQL commands to find out the following, and keep track of them in the file called sql_commands.txt

  1. All columns for all players from the New York Knicks (NYK)
  2. All columns for all players from the Indiana Packers (IND) who are under 26 years old
  3. All columns for all players, ordered from least points scored to most points scored

Further - do these in any order:

Further (use some SQL functions in queries)

  1. All columns for all players on the New York Knicks who scored over 1000 points
  2. All columns for all players on the Chicago Bulls (CHI) who scored under 300 points
  3. Select team column only for players that scored 2 or less points in a game.
  4. The average age for all players https://www.w3schools.com/sql/sql_count_avg_sum.asp

Further

Write the node.js client.query code that executes each SQL statement from part 3 and console.logs the results.

Further

Write the node.js code that runs an array of string sql statements and console.logs the results.

nba_stats's People

Contributors

awongh avatar joe-gz avatar nickangtc avatar robertakarobin 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.