Intern
Task 1. Counting clients by status Requirement: Write a query that outputs the number of clients in each status (active, inactive, blocked, etc.). The result should contain two columns: status and cnt.
sobes.tech AI
Answer from AI
To count the number of clients by status, you can use an SQL query with grouping by the status field and the COUNT(*) function to count the rows in each group. For example:
SELECT status, COUNT(*) AS cnt
FROM clients
GROUP BY status;
Here, clients is the name of the table with clients, and status is the field where the client's status is stored. The result will contain two columns: status and cnt — the number of clients with that status.