Code Monkey home page Code Monkey logo

beginner-postgres-code-along's Introduction

Project Summary

In this project, we'll be practicing inserting and querying data using SQL. We'll make use of an online database emulator tool found Here. Careful, if you reload the page your changes will be lost.

On the left are the Tables with their fields. The right is where we will be writing our queries. The bottom is where we will see our results.

Step 1

Instructions

SELECT all the data FROM the artist table.

Solution

SQL Solution
SELECT * FROM artist;

Step 2

Instructions

SELECT the first_name, last_name, and country FROM the employee table.

Solution

SQL Solution
SELECT first_name, last_name, country
FROM employee;

Step 3

Instructions

SELECT the name, composer, and milliseconds FROM the track table WHERE the milliseconds are greater than 299000.

Solution

SQL Solution
SELECT name, composer, milliseconds
FROM track
WHERE milliseconds > 299000;

Step 4

Instructions

SELECT the count FROM the track table WHERE the milliseconds are greater than 299000.

Solution

SQL Solution
SELECT count(*)
FROM track
WHERE milliseconds > 299000;

Black Diamond

Now that we have some basic query examples. Let's try doing some more complicated ones. Use www.sqlteaching.com or sqlbolt.com as resources for the missing keywords you'll need.

  1. Find the average length of all tracks in milliseconds
  2. Find the number of invoices in the USA
  3. Make a list of all the First Names of Customers that contain an 'a'
  4. Make a list of the 10 longest tracks
  5. Make a list of the 20 shortest tracks
  6. Find all the customers that live in California or Washington
  7. Find all the customers that live in California, Washington, Utah, Florida, or Arizona (Use IN keyword)
  8. Insert an artist to the database
  9. Insert yourself as a customer to the database
  10. Find a list of all Playlists that start with Classical
  11. You can either continue exploring this dataset or look into setting up postgres on your local machine.

Contributions

If you see a problem or a typo, please fork, make the necessary changes, and create a pull request so we can review your changes and merge them into the master repo and branch.

Copyright

© DevMountain LLC, 2017. Unauthorized use and/or duplication of this material without express and written permission from DevMountain, LLC is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to DevMountain with appropriate and specific direction to the original content.

beginner-postgres-code-along's People

Contributors

brackcarmony avatar devlemire avatar steven-isbell avatar jrobber avatar bahull avatar craig1123 avatar timbiles 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.