APIs & Data
Query
What It Is
A request for specific data from a database
Analogy
Asking the librarian for "all books by Stephen King published after 2010"
Try It Out
Bashqueries.sql
| 1 | -- Find all users over 21 |
| 2 | SELECT * FROM users WHERE age > 21; |
| 3 | |
| 4 | -- Count orders by status |
| 5 | SELECT status, COUNT(*) |
| 6 | FROM orders |
| 7 | GROUP BY status; |
| 8 | |
| 9 | -- Join users and orders |
| 10 | SELECT u.name, o.total |
| 11 | FROM users u |
| 12 | JOIN orders o ON u.id = o.user_id; |
Related Terms in APIs & Data
API (Application Programming Interface)
A waiter at a restaurant — you tell them what you want (request), they bring it from the kitchen (response)
API Key
A VIP pass that tells the bouncer who you are and what you're allowed to do
Request
Placing an order with the waiter
Response
The food the waiter brings back from the kitchen