
SQL - Joins
INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, CROSS JOIN, self joins, multiple joins
1Which type of join returns only rows that have a match in both tables?
Which type of join returns only rows that have a match in both tables?
Answer
INNER JOIN returns exclusively the rows where the join condition is satisfied in both tables. Rows without a match in either table are excluded from the result. It is the most commonly used join type in SQL because it guarantees that every row in the result contains complete data from both tables.
2Which keyword is used to specify the matching condition between two tables in a join?
Which keyword is used to specify the matching condition between two tables in a join?
Answer
The ON keyword defines the matching condition between columns of both tables during a join. The standard syntax is SELECT ... FROM table1 JOIN table2 ON table1.column = table2.column. It is also possible to use USING when the join columns have the same name in both tables, but ON remains the most flexible and universal form.
3What does a LEFT JOIN return when a row from the left table has no match in the right table?
What does a LEFT JOIN return when a row from the left table has no match in the right table?
Answer
A LEFT JOIN keeps all rows from the left table, whether or not they have a match in the right table. When there is no match, the columns from the right table are filled with NULL values. This behavior is particularly useful for identifying orphan records or ensuring that no data from the main table is lost during the join.
What is the main difference between LEFT JOIN and RIGHT JOIN?
What result does a CROSS JOIN produce?
+17 interview questions
Other Data Analytics interview topics
Google Sheets - Fundamentals
Google Sheets - Advanced Formulas
SQL - Fundamentals
SQL - Aggregations and Grouping
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