
SQL - Aggregations and Grouping
COUNT, SUM, AVG, MIN, MAX, GROUP BY, HAVING, nested aggregate functions, COALESCE, CASE WHEN
1Which SQL function counts the number of rows in a table?
Which SQL function counts the number of rows in a table?
Answer
COUNT is the SQL aggregate function that counts the number of rows returned by a query. COUNT(*) counts all rows including those with NULL values, while COUNT(column) only counts rows where the specified column is not NULL.
2Which SQL function calculates the sum of values in a numeric column?
Which SQL function calculates the sum of values in a numeric column?
Answer
SUM is the aggregate function that adds up all non-NULL values in a numeric column. It is commonly used to calculate totals such as revenue, quantities sold, or any other cumulative value. If all values are NULL, SUM returns NULL.
3What is the difference between COUNT(*) and COUNT(column)?
What is the difference between COUNT(*) and COUNT(column)?
Answer
COUNT(*) counts all rows in the result, including those containing NULL values in any column. COUNT(column) only counts rows where the specified column has a non-NULL value. This distinction is essential when analyzing incomplete data.
Which SQL function returns the average value of a numeric column?
What is the role of the GROUP BY clause in an SQL query?
+17 interview questions
Other Data Analytics interview topics
Google Sheets - Fundamentals
Google Sheets - Advanced Formulas
SQL - Fundamentals
SQL - Joins
BigQuery - Fundamentals
Data Cleaning
KPIs and Business Metrics
Descriptive Statistics
Zapier and No-Code Automation
Data Visualization Principles
Python & Pandas - Fundamentals
Google Sheets - Automated Dashboards
SQL - Subqueries and CTEs
SQL - Window Functions
BigQuery - Advanced Features
Data Modeling
Funnel and Conversion Analysis
Cohort and Retention Analysis
Google Tag Manager and Tracking
APIs and Webhooks
dbt - Fundamentals
AB Testing and Applied Statistics
Looker Studio (Google Data Studio)
Power BI - Fundamentals
SQL - Advanced Analytical Queries
dbt - Advanced Features
Power BI - DAX and Advanced Dashboards
Python Analytics - Advanced Analysis and ML
Master Data Analytics for your next interview
Access all questions, flashcards, technical tests, code review exercises and interview simulators.
Start for free