Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mohibbulla-munshi/5b7b3676fe24acb624c25ad0115f154a to your computer and use it in GitHub Desktop.
Save mohibbulla-munshi/5b7b3676fe24acb624c25ad0115f154a to your computer and use it in GitHub Desktop.
Database For Software Developers
Simple database system for an online bookstore.
@mohibbulla-munshi
Copy link
Author

Display a list of 20 latest published in-stock book titles of the store

SELECT book_title
FROM books
WHERE stock > 0
ORDER BY created_at desc
LIMIT 20;

@mohibbulla-munshi
Copy link
Author

Retrieve a list of all purchases since January 01, 2023.

SELECT *
FROM purchases
WHERE purchase_date >= '2023-01-01';

@mohibbulla-munshi
Copy link
Author

List down all the authors in the database who have “Mohammad” or “MD” at the beginning of their name, sorted by the names (alphabetically)

SELECT *
FROM authors
WHERE first_name LIKE 'Mohammad%' OR first_name LIKE 'MD%'
ORDER BY first_name;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment