zoey2111 / SQL-Notes

0 stars 0 forks source link

0514 #1

Open zoey2111 opened 2 months ago

zoey2111 commented 2 months ago

List all directors of Pixar movies (alphabetically), without duplicates SELECT DISTINCT director FROM movies ORDER BY director ASC;

zoey2111 commented 2 months ago

List the last four Pixar movies released (ordered from most recent to least) SELECT title, year FROM movies ORDER BY year DESC LIMIT 4;

zoey2111 commented 2 months ago

List the next five Pixar movies sorted alphabetically SELECT title FROM movies ORDER BY title ASC LIMIT 5 OFFSET 5; LIMIT 5: This limits the number of results returned by the query to 5. Essentially, it tells the database to only give back the top 5 records after sorting.

OFFSET 5: This is used to skip the first 5 records in the results. An OFFSET of 5 means, "Start giving me results from the 6th record."

zoey2111 commented 2 months ago