Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

It's year 2032, and flying cars are finally here. For safety, each is equipped with a black box that logs (every second): GPS timestamp, GPS

 It's year 2032, and flying cars are finally here. For safety, each is equipped with a black box that logs (every second): GPS timestamp, GPS latitude, longitude, and altitude.

To keep its flying registration, your flying car transmits this data nightly to the FAA, so your safe flying record can be verified (or appropriate tickets issued if not).

Your job as a contractor for the FAA is to write queries that generate tickets. Your database gets 50 million car records per day (all flying cars in the US, in year 2032), each one logging their position every second for the entire day. Your task is:

1. a query that identifies speeders (anyone flying over 500mph). What's the running time of your query, in big-O notation (how will the database execute your SQL?).

2. Airborne flying cars must keep a distance of 50 feet away from any other airborne flying car. a query that identifies violators and tickets *both* cars [assume airborne means 50 feet altitude]. Again, what's the running time of your query in big-O notation.

Note, millions of records, you can't just do an inner join and compare distances: you may assume the existance of a "distance" function that takes two sets of coordinates as arguments, e.g.: distance(x1,y1,z1,x2,y2,z2) and returns distance.

Part2: It's year 2022, and the city is strapped for cash. You notice license-plate reading cameras at highway entrances and exits (and all intersections), and get an idea... someone is taking a picture and logging the license plates in a database for every car that goes near those cameras. We get: GPS timestamp, GPS latitude and longitude of camera, and car license plate.

Your job as a DMV contractor: a query to ticket top 5% of speeders, assuming max speed within the city (including highways) is 50mph.

Hint: If a car is photographed at location X, at 9:00:00am, and is then photographed again at some other random location Y, that is 1 mile away at 9:01:00am, that implies the car drove at 60mph (1-mile in 1-minute) between the two locations. Note that we don't care which road the driver used---unless they can bend space-time and teleport, they *had* to have gone at *least* 60mph between the two locations.

Note that part2 is somewhat different from part1... For both parts, assume your database is *huge* (millions of records---try to come up with solutions that are faster than O(n^2)).

Submit SQL queries to solve both problems

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

A First Course in Differential Equations with Modeling Applications

Authors: Dennis G. Zill

11th edition

1305965728, 978-1305965720

More Books

Students also viewed these Databases questions