Giter VIP home page Giter VIP logo

ds-skills2-filtering-and-ordering-lab's Introduction

Filtering and Ordering - Lab

Introduction

In this lab, we will write more SELECT statements to solidify our ability to query a SQL database. We will also write more specific queries using the tools we learned in the previous lesson.

Objectives

You will be able to:

  • Limit the number of records returned by a query using LIMIT
  • Filter results using BETWEEN and IS NULL
  • Order the results of your queries by using ORDER BY (ASC & DESC)

Famous Dogs

We have a database full of famous dogs! The dogs table is populated with the following data:

name age gender breed temperament hungry
Snoopy 3 M beagle friendly 1
McGruff 10 M bloodhound aware 0
Scooby 6 M great dane hungry 1
Little Ann 5 F coonhound loyal 0
Pickles 13 F black lab mischievous 1
Clifford 4 M big red smiley 1
Lassie 7 F collie loving 1
Snowy 8 F fox terrier adventurous 0
NULL 4 M golden retriever playful 1

Queries

Write your SQL queries in the select.py file. Fill the empty string in each method with the proper query to get the tests in test/index_test.py to pass.

  • select_all_female_dogs_name_and_breed returns the name and breed for all female dogs

  • select_all_dogs_names_in_alphabetical_order returns the names of all dogs listed in alphabetical order. Notice that SQL lists the nameless dog first.

  • select_nameless_dog returns all information for any dog that doesn't have a name

  • select_hungry_dogs_name_and_breed_ordered_by_youngest_to_oldest returns the name and breed of only the hungry dogs and lists them from youngest to oldest

  • select_name_age_and_temperament_of_oldest_dog returns the oldest dog's name, age, and temperament

  • select_name_and_age_of_three_youngest_dogs returns the three youngest dogs

  • select_name_and_breed_of_dogs_between_age_five_and_ten_ordered_by_oldest_to_youngest returns the name and breed of only the dogs who are between five and ten years old

  • select_name_age_and_hungry_of_hungry_dogs_between_age_two_and_seven_in_alphabetical_order returns the name, age, and hungry columns for hungry dogs between the ages of two and seven. This query should also list these dogs in alphabetical order.

Summary

Great work! In this lab we practiced writing more complex SQL statements to not only query specific information but also define the quantity of results and the order of our results.

ds-skills2-filtering-and-ordering-lab's People

Contributors

mathymitchell avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

doyarzunv

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.