Q61. Function to count results?
`COUNT()`. `COUNT(*)` counts rows. `COUNT(column)` counts non-NULL values. ```sql SELECT COUNT(*) FROM orders; -- Total orders SELECT COUNT(shipped_date) FROM orders; -- ...
Technical Question Bank · Peer-Reviewed
Search and filter frequently asked interview questions across technical, programming, and behavioral domains. Tailor your interview preparation by difficulty for freshers or experienced developers (142 available).
`COUNT()`. `COUNT(*)` counts rows. `COUNT(column)` counts non-NULL values. ```sql SELECT COUNT(*) FROM orders; -- Total orders SELECT COUNT(shipped_date) FROM orders; -- ...
**Aggregate functions** perform a computation on a set of values across multiple rows and return a single summarizing value: ### Core Standard Aggregate Functions: 1. **`...
To return the total count of rows in the `Customers` table, use **`COUNT(*)`**: ```sql SELECT COUNT(*) AS total_customers FROM Customers; ``` ### `COUNT(*)` vs `COUNT(col...
In the SQL `ORDER BY` clause, sorting direction is controlled by two keywords: 1. **`ASC` (Ascending)**: Sorts from lowest to highest (1 to 9, A to Z, oldest date to newe...
If no direction keyword is specified in an `ORDER BY` clause, the default sort order is **`ASC` (Ascending)**: ```sql -- These two queries produce identical ordering: SEL...
```sql -- MySQL / PostgreSQL SELECT name, mark FROM Students ORDER BY mark DESC LIMIT 3; -- SQL Server SELECT TOP 3 name, mark FROM Students ORDER BY mark DESC; -- Oracle...
To sort the `Customers` table in descending alphabetical order (Z to A) by `FirstName`, append `ORDER BY FirstName DESC`: ```sql SELECT * FROM Customers ORDER BY FirstNam...
```sql SELECT name, COUNT(name) FROM customers GROUP BY name; ``` In standard SQL (and MySQL 5.7+ with `ONLY_FULL_GROUP_BY`), any non-aggregated column in SELECT must app...
| WHERE | HAVING | |-------|--------| | Filters **rows** | Filters **groups** | | Executes **before** GROUP BY | Executes **after** GROUP BY | | Cannot use aggregates | C...
A **`JOIN`** clause in SQL combines rows from two or more tables based on a related column between them (typically a Foreign Key referencing a Primary Key). ### The Need ...
HireXTech uses essential storage to remember your study preferences and third-party advertising cookies via Google AdSense in compliance with GDPR. You can choose to enable essential cookies only or accept all cookies. Read our Privacy Policy.