0% found this document useful (0 votes)
16 views

Data Analyst Interview Questions Part 2

The document provides interview questions and answers for data analysts, focusing on SQL concepts such as fact and dimension tables, primary and foreign keys, and types of primary keys. It also explains the differences between appending and merging queries in Power BI. Each section includes definitions and examples to clarify the concepts discussed.

Uploaded by

peyewoj749
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Data Analyst Interview Questions Part 2

The document provides interview questions and answers for data analysts, focusing on SQL concepts such as fact and dimension tables, primary and foreign keys, and types of primary keys. It also explains the differences between appending and merging queries in Power BI. Each section includes definitions and examples to clarify the concepts discussed.

Uploaded by

peyewoj749
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Data Analyst

Interview
Questions
Part 2
Difficulty Level:
02 codebasics.io

SQL:
1 What is a fact table and what is a dimension table?
Difficulty:

Try to answer before checking the answer

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

A fact table contains measurements, metrics, or facts about a business process.


It generally compresses transactional data.

It has two types of columns: one representing facts of the business and another
containing foreign keys to dimension tables.

Fact tables are connected to dimension tables using foreign keys.

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

2 What is the difference between a foreign key and a


primary key?
Difficulty:

Try to answer before checking the answer

codebasics.io
Primary Key Foreign key

Primary Key: A primary key is a unique identifier for each record in a database
table.

It must contain unique values, and it cannot contain NULL values.

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

3 Explain the types of primary keys.


Difficulty:

Try to answer before checking the answer

Types of Primary Keys

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.

For example, UserID.

Composite Primary Key: A composite primary key consists of two or more


columns to uniquely identify a record within a table. The uniqueness is
guaranteed by the combination of values in these columns, rather than by a
single column value.

For example, a Composite Primary Key could be used in a CourseEnrollments


table, which tracks the courses each student is enrolled in. This table might
include at least two columns: StudentID and CourseID combination as the
primary key.
06 codebasics.io

POWER BI:
4 How many primary keys can we have in a table?
Difficulty:

Try to answer before checking the answer

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

5 What is the difference between appending and merging


queries?
Difficulty:

Try to answer before checking the answer

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.

Example: Appending the march_salary and april_salary tables.

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.

Check out the complimentary


resource to enhance your resume
E n a b l i n g C a r e e r s

Found this interesting?


To gain access to more valuable content,
join our WhatsApp Channel

SCAN TO JOIN

codebasics.io

You might also like