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

SQL Day1

The document outlines a SQL workshop hosted by Newton School of Technology, which includes four classes focused on SQL querying, case studies, and mentorship. It highlights the importance of SQL skills for various analyst roles and provides an overview of data science, its branches, and the curriculum offered. The workshop aims to prepare students for industry interviews and practical applications of SQL in data analysis, with a certification awarded for attendance and performance.

Uploaded by

singhsimrann28
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

SQL Day1

The document outlines a SQL workshop hosted by Newton School of Technology, which includes four classes focused on SQL querying, case studies, and mentorship. It highlights the importance of SQL skills for various analyst roles and provides an overview of data science, its branches, and the curriculum offered. The workshop aims to prepare students for industry interviews and practical applications of SQL in data analysis, with a certification awarded for attendance and performance.

Uploaded by

singhsimrann28
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 40

LEARNING

FOR
GROWTH
BASICS OF
SQL
WHO ARE WE?

• 4500+ STUDENTS PLACED


• PLACED A LEARNER AT HIGHEST SALARY OF
50LPA
• SOME ALUMNI ARE WORKING AT GOOGLE,
FRACTAL, ETC.
• OUR COLLABORATIONS (GOA GOVT, FOREIGN
UNIVERSITIES)
• MULTIPLE B.TECH COLLEGES
• NEWTON SCHOOL OF TECHNOLOGY RUNS
INDIA’S FIRST AI BTECH PROGRAM
PRODUCT DEMO
• UNLOCKED
⚬ Home
⚬ My Timeline
⚬ Calendar
⚬ Expert Sessions
⚬ Leaderboard
⚬ Arena
⚬ Assignments

• LOCKED (FOR ENROLLED IN PLACEMENT


PROGRAM)
⚬ Placements
⚬ Projects
⚬ Mock Interviews
⚬ Doubt Forum
⚬ Many more….
SQL WORKSHOP
• 4 CLASSES:
⚬ DAY1: INTRO TO SQL QUERYING with E-
COMMERCE DB
⚬ DAY2: E-COMMERCE CASE STUDY WITH SQL
⚬ DAY3: MENTOR SESSION
⚬ DAY4: UNLOCK THE DATA SCIENCE ROADMAP

• CERTIFICATION (MINIMUM 75% Attendance)


• TOP 3 PERFORMERS OF THE SERIES WILL GET A
MOCK
INTERVIEW WITH INDUSTRY EXPERTS
INSTRUCTOR
SHREY JAIN

• WORKED AT MAJOR DATA FIRMS


• 6+ years of experience in Data in
firms like Accenture, Scienaptic.AI,
PharmEasy
AGENDA

• WHAT IS Data Science ?


• ROLE OF SQL in Data Profession
• E-COMMERCE INTRODUCTION
• Database
• Basics of SQL
⚬ SQL Querying
⚬ SQL Flow
⚬ Interview Expectations
SO GET READY!!

1.ENSURE TO CODE ALONG WITH ME


2.WHILE WE ARE CODING, ENSURE TO HAVE SPLIT
SCREEN SETUP (VIDEO + NS PLAYGROUND)
3.BE ACTIVE IN THE CHAT
DATA SCIENCE

Data Science is a very vast field that focuses on extracting insights and
knowledge from data. It integrates various disciplines including statistics,
mathematics, advanced computing, artificial intelligence (AI), and machine
learning to analyze, model, and interpret large datasets.

HealthCare: Diagnosing patients

Finance: Automate Trading


DATA SCIENCE BRANCHES

There are several data science branches related to data, that are involved
in getting insights from the data and then using those insights to make
decisions or predict something. Few of these branches are:

ARTIFICIAL MACHINE BIG DATA


INTELLIGENCE LEARNING DATA ANALYTICS
WHAT DO WE TEACH IN DATA SCIENCE?
• At Newton School we have designed our curriculum to cover the most relevant fields that
would ensure higher chances of success in data related fields.

• We cover Data Analyst, Business Analyst, and Data Science + Machine Learning +
Deep Learning in this order only.

• We also provide electives of Tableau, Entrepreneurship, Gen AI, etc which learners are
free to choose from.
Who all have given Analyst
interviews?
What was the most asked skill?
In this series, we will discuss SQL as it is
expected in almost 80% of analyst
openings like product analyst, growth
analyst, business analyst, etc

Most of the data


generated in the
companies is very large
and requires proper
maintenance of a data
pipeline then optimally
query over it to get the
insights.
Let’s look at Google SQL Interview Question
Given the data of customer purchases, mark each possible pair of
customers as "completely similar", "partially similar", or "not
similar".

SAMPLE SAMPLE
INPUT OUTPUT
ARENA Q: Identify Similar Customer Profiles Based on Purchased
Product Categories
Let’s look at Amazon SQL Interview
Question
Given the data of sales, mark each store’s average daily sales in April 2024
as “lower”, “higher” or “same” when compared to average daily sales of the
company in April 2024.

SAMPLE SAMPLE
INPUT OUTPUT
ARENA Q: Comparing Store Revenue to Company Average
for April 2024
This is the level of
questions asked in Major
firms like Google and
Amazon, so one needs to
be really good with their
SQL and problem-solving
skills.
Here just knowing concepts like CTE, Join, etc won’t
help you understand how to solve problems how to
calculate metrics, and so on to work optimally in a
competitive analytics team

In this session, we will start learning how to


understand an SQL problem and approach it from
scratch
Let’s first learn about Database before we start to
work on database!!
UNDERSTANDING DATABASE AND SQL

You can think of DBMS as the Library and SQL as the librarian!
HOW EXCEL FALLS SHORT?

• Dealing with large dataset: Excel may struggle to handle large dataset efficiently,
leading to slow performance and potential crashes.

• Complex Queries: Performing complex queries with Excel's formula-based


approach can be cumbersome.

• Real-time Updates: Manually updating and reworking Excel spreadsheets every


time new data arrives can be time-consuming and error-prone.

That’s where Database and SQL comes in to optimize the operations of DATA.
What is a DATABASE?

A database — headquarters/base for data!

• You will be able to rapidly search for and find items(especially missing socks)
[SEARCH]
• Easily modify each drawer without affecting the others. [ALTER AND UPDATE]
• Get rid of a particular set of clothing without a second thought. [DELETE]

Database is like your neat and organised bedroom wardrobe.


SCHEMA: DATABASE VISUALIZATION

• Each table has its own primary key, which is a unique


identifier for the entity. The Product and Customer
tables also have a foreign key, which establishes a
relationship with the Category and Order tables,
respectively.
WHAT IS SQL?
SQL (Structured Query Language) is a special language used to communicate with
and manage databases. To illustrate, think of it as the tool that assists you in finding a
book in a library.

DATABASE SQL USER

LIBRARY LIBRARI
AN
FACILITATO
R
• There are multiple platforms like METABASE, GOOGLE BIGQUERY, MYSQL
WORKBENCH, DBEAVER that allow querying on hosted or local databases.

• For our sessions we will use Newton’s MySQL Playground which already
has the hosted database.

Newton’s MySQL Playground: Link


E-Commerce databases

You must have heard about E-commerce companies


like:
⚬ Amazon,
⚬ Flipkart,
⚬ Meesho,
⚬ Alibaba,....

🧐 But can you think of the


possible tables and attributes
for the database at one of
these companies?
BASIC SQL QUERIES
• We will use this simple E-Commerce database for our
sessions:
BASIC SQL QUERIES
1. Let’s look at the tables of our database:

2. Let’s explore the tables one by one:


a.SELECT, FROM

b.WHERE
BASIC SQL QUERIES
d. ORDER BY

e. LIMIT

f. Aggregation (SUM, AVG, MAX, MIN)


WRITE THE FOLLOWING QUERIES:

• Get all the payments data, which have all the following properties:
a.Payment is made after July 2023
b.Payment amount exceeds 10000

• Get all the products data, which have either of the following properties:
a.Category are either of Clothing, Footwear
b.Stocks is less than 100
SQL FLOW
There are so many SQL clauses like SELECT, FROM, ORDER BY, LIMIT, GROUP BY, etc, how
does SQL know which to execute first and which to execute later?

We can simplify this, in order for


SQL to give any output, we first
need to tell what’s the data and
then if we are filtering the data, if
we are aggregating it and so on.
SQL FLOW
INTERVIEW EXPECTATIONS
When SQL is asked in the interviews there are 3 type of
questions:
1. Theoretical Questions:
a. What is Relational DB?
b. Difference between CTE and Views.

2. Scenario Based Questions:


c. If we have got some incorrect data inserted in a
table, how can we remove them?

3. Coding Problems:
d. Here either you are given a database or given the
description of a data, and asked to solve for a
requirement.
IDEAL METHODOLOGY
Expectations from an analyst in SQL:
1.Should be able to code
2.Should be able to explain and optimize

That’s what we should try to emphasize while


giving interviews, therefore solve a coding
problem like this:
3.Understand the requirements and given database
4.Explain your approach to the interviewer
5.Code down the Solution
How to explain your approach?

Explanation:
1.Firstly break down the problem into steps.
2.Then try to get the output of each step in stages
3.At the end, get the overall output either by combining the steps or executing the final
step.

In the next session, when we will be solving a few questions live, we will
discuss this in more depth, because all the folks need to be on the same page
regarding their awareness of SQL
Practice Components
Let’s try to solve few mandatory assignment questions on Newton’s Platform:

1.Open the dashboard


2.Go to assignment tab of the Home section
3.Click on any of the question (Try the one with highest matches played
component)
Homework Assignment

• We didn’t solve all the released questions


• 4 more questions will be released after the session
⚬ LESS THAN 1000 RUNS
⚬ DRAFTED INTO NFL
⚬ N-COURSES PROBLEM
⚬ TOP FIVE

It won’t take a lot of time for you (max 30 min.) for completing the questions,
so solve it!!
ARENA
We’ve given all the learners access to Arena.

Highlights for ARENA:


1.Almost 100 SQL Coding Questions.
2.Interview Aligned questions in different difficulty spectrums.
3.All the important topics are included in this Questionnaire.

Let’s look at one of the questions: The cheap flier connection (Present in
Arena)
STEPWISE APPROACH
First of all, I hope you all realise it’s not a straightforward question that will be solved by a simple
group by or a join.

STEPS:
1.First we need to get the data of all the possible total cost for 0, 1 or 2 stops for
each starting and end city pair.
2.We can get these using self joins.
3.Then for each 0, 1 and 2 stop, we can combine the results using set operations
4.In the end we can simply group the data we got from 3rd step using origin and
destination to get the minimum for all the pairs.

• In the next session we will discuss solving questions in this manner only.
E-Commerce (test_db on NS Playground)
PROBLEM STATEMENT FOR THE NEXT
SESSION
Analyze the trend of spending in different customers’
segments (like Occasional shoppers, Regular Buyers, and
VIP Customers) over the months.

Here can we solve this using multiple steps:


1.First segment the customers on the basis of their
spending
2.Observe the trend in percentage of different
customer segments each month
3.Trend in average order value for each segment
over the month
4.Is there any influence of Product categories on
customer segments?
THANK YOU.

You might also like