Data Analyst Interview Questions Part 2
Data Analyst Interview Questions Part 2
Interview
Questions
Part 2
Difficulty Level:
02 codebasics.io
SQL:
1 What is a fact table and what is a dimension table?
Difficulty:
codebasics.io
I am a table;
I talk about facts.
I am a table;
I look dim - haha!
codebasics.io
fact_table dim_table
03 codebasics.io
It has two types of columns: one representing facts of the business and another
containing foreign keys to dimension tables.
Dimension tables consist of attributes that describe the objects of a fact table.
Each dimension table includes a primary key that uniquely identifies each record and
using this key dimension table associated with fact tables.
The fact table will be updated frequently, whereas the dimension table won't often be
updated with new records.
For example, whenever an order is placed, the fact_order table is updated, but the
dim_item table is updated only when a new item is introduced into the store.
04 codebasics.io
codebasics.io
Primary Key Foreign key
Primary Key: A primary key is a unique identifier for each record in a database
table.
Foreign Key: A foreign key is a column or set of columns that corresponds to the
primary key in another table.
The foreign key is defined in the child table but it references the primary key of
the parent table, establishing a relationship between the two tables.
05 codebasics.io
codebasics.io
There are two types of Primary Keys: Simple Primary Key and Composite Primary
Key.
Simple Primary Key: This consists of a single column within a table. Each row's
value in this column is unique, ensuring that no two rows can have the same
value in this field.
POWER BI:
4 How many primary keys can we have in a table?
Difficulty:
ra
de d fo ? Primary
nee hip
ha t is lations Key!
W d re
goo
codebasics.io
A table can have only one primary key, which can consist of single or multiple
fields (columns).
07 codebasics.io
codebasics.io
codebasics.io
codebasics.io
codebasics.io
08 codebasics.io
Appending Queries: This process involves taking the rows of one query and
adding them to the bottom of another query, effectively concatenating them
vertically. This is used when we have data of the same type spread across
multiple sources and want to create a single, continuous dataset.
Merging Queries: Merging Queries: This is the process of combining two queries
based on a common column, similar to a JOIN in SQL. It combines the rows of two
queries to create a single dataset where each row includes information from
both sources, based on matching data in the specified column(s).
Example: Merging the Employee table and the Department table based on
department_id, which results in a table where each employee is associated with
their respective department name.
SCAN TO JOIN
codebasics.io