1 / 9

Introduction to SQL Exercises

Introduction to SQL Exercises. Exercise 1. Suppose we have data on: Animal name Type (eg: bird, fish, mammal) Speed (kph/mph) Speed types(eg running, swimming, flying, diving etc) Give a relational database schema for a database with this information. Exercise 2.

tobit
Download Presentation

Introduction to SQL Exercises

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to SQLExercises

  2. Exercise 1 • Suppose we have data on: • Animal name • Type (eg: bird, fish, mammal) • Speed (kph/mph) • Speed types(eg running, swimming, flying, diving etc) • Give a relational database schema for a database with this information

  3. Exercise 2 • Write the SQL to create tables for: • animalType(typeID, description) • speedType(typeID, description) • animal(name, animalType) • animalSpeed(animalName, speedType, topSpeed)

  4. Exercise 3 • Write the SQL to: • Insert a speedType with typeID of 1 and description running • Insert aspeedTypewith a typeID of 2 and description diving • Insert an animalSpeedfor a running cheetahof 112kph • Insert an animalSpeed for a diving peregrine falcon of 387.2kph

  5. Exercise 4 • Write the SQL to: • Update the animalSpeed of the cheetah to 113kph • Delete the animalSpeed entry for the peregrinefalcon

  6. Exercise 5 • Write the SQL to: • Select all records and fields from the speedType table • Select all animalNames from the animal table • Select all entries for peregrine falcons from the animalSpeed table • Select all entries for diving peregrine falcons from the animalSpeed table

More Related