medium10 pts · first answer countsindexingsql
Checking if any row exists
An API checks whether a customer has any order using SELECT COUNT(*) FROM orders WHERE customer_id = $1 and then tests count > 0. What is a better query?
Discussion 0
Join free to post in the discussion.
Related questions
- Purpose of a primary keyDatabase Administrator
- When a B-tree index helpsDatabase Administrator
- INNER JOIN vs LEFT JOINDatabase Administrator
- DELETE vs TRUNCATEDatabase Administrator
- Filtering rows where a value is NULLDatabase Administrator
- COUNT(*) vs COUNT(column)Database Administrator
- What a foreign key enforcesDatabase Administrator
- WHERE vs HAVINGDatabase Administrator