GithubHelp home page GithubHelp logo

ss-fluency10's Introduction

Directions

For today's fluency, we're going to be doing a bunch of exercises for PostreSQL, to build that foundation and build up fluency in it. Practice these exercises wherever you have PostgreSQL, and in the file provided, type down the queries that solve the exercise! Here's the PostgreSQL documentation should you need it [https://www.postgresql.org/docs/12/index.html], as well as the Launch School book for any additional notes you need [https://launchschool.com/books/sql/read/introduction].

Exercises

  1. Create a database, called animals.

  2. Go inside that database and create another table, wild, that takes in a recurring ID, the type of animal it is, where it lives, and what it preys on.

  3. Insert at least 5 wild animals inside the wild table. Make sure that there's a few different types of animals!

  4. Now, create another table, domestic, that takes in an ID that's recurring, the type_id based on its family's type, its lifespan, and what it likes to eat. The type_id should be a FOREIGN KEY.

  5. Insert at least 5 domestic animals inside the domestic table.

  6. Hold up - let's alter one slight thing in our domestic table! We want to make sure that everyone knows it's mandatory to put in a type of animal. Set that parameter to include the NOT NULL constraint.

  7. Now you have two tables! (If you would like to check them, use the \dt command, or to view more info on a specific table, use the \d (database) command. Try them out!) Let's mess with the domestic table a bit. Write a query that returns the type of animal that has the longest type length. Then write a query that gets the second animal from your table.

  8. Let's try to connect these tables together based on similar animal types. First, alter the ID's on both tables to include a PRIMARY KEY.

  9. Now, join the two tables by type! We want to display the animal type, as well as what they like to eat. Make sure the ID's match so you can successfully join the two tables together!

  10. Let's join them together again, but this time, let's group the types together so it be more organized.

ss-fluency10's People

Contributors

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