Professional Documents
Culture Documents
Portfolio - Ramadhan Khansa Akbari
Portfolio - Ramadhan Khansa Akbari
PILOT - CLASS
RAMADHAN KHANSA AKBARI
Basic sql
FOR ANALYSIS
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
TABLE OF CONTENT
Literal, operator,
01 SQL Introduction 02 function, filtering
SQL
01
Introduction
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
What is sql?
SQL or Structured Query Language is a simple computer
language used for communicating with Relational Database
System.
SQL have some category :
‘Select’ statement
SELECT is one of SQL QUERY used for retrieving data
from one or some RDBMS table
SELECT syntax :
EXample
EXample
prefix
PREFIX is part of database object’s name with higher
hierarchy
PREFIX can be written :
PREFIX database_object’s_name
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
alias
ALIAS is used to guve a table, or a column in a table, a
temporary name.
ALIAS can be written :
Database_object’s_name as [ALIAS]
Database_object’s_name [ALIAS]
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
EXample
Literal, Operator,
02 Function, filtering
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
literal
LITERALS are the string or integer values representing
data retrieved from the database.
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
function
FUNCTION is a stored program that you can pass parameters into and
then return a value. Here are some function we could use in MySQL
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
filtering
Filtering is a is a process for limit the output data generated based on
the condition or some criteria. The application of filtering in MySQL is
using WHERE
Sample case
Can you help the sales team to show all
transactions with their price and quantity so
that they know which product has the highest
sale with minimum purchase 200,000 ?
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
SOLUTION
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
Sample case
A customer name Agus Cahyono complains to
customer service regarding warranty issues. Help CS
to find out if the customer can still claim the warranty
(Company’s warranty rules :
1. Two and a half year maximum / 732 days
2. Only applicable on electronic purchase)
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
SOLUTION
Customer List
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
Data sorting
03 aggregation
Data grouping
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
Data sorting
Data sorting in MySQL can be done with ORDER BY keyword.
ORDER BY used to sort the result-set in ascending or descending
order. The ORDER BY sorts the record in ascending order by default
aggregation
MySQL's aggregate function is used to perform calculations on multiple values
and return the result in a single value like the average of all values, the sum of all
values, and maximum & minimum value among certain groups of values
aggregation
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
Data grouping
The MYSQL GROUP BY clause is used to collect data from multiple records
and group the result by one or more column. It is generally used in a SELECT
statement.
having
The HAVING clause was added to SQL because the WHERE keyword
cannot be used with aggregate functions.
Sample case
Help the marketing team to know which of the
product is the best seller and which product sold less
by displaying all the total sales of the product with
condition the product sold more than 3.
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
SOLUTION
Sample case
Help Marketing Team to find the candidate for the
giveaway winner who buy most of the product.
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
SOLUTION
SOLUTION
From this list, we can inform that the winner of the giveaway contest
is Heidi Goh
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
04 Combining data
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
join
JOINS in MySQL are used to retrieve data from multiple tables. A
MySQL JOINS are performed whenever two or more tables are joined in
SQL statement.
EXample
EXample
Join in mysql
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
Sample case
Help Packer order team to find the name, addresses
and the item they purchased from the shop (Only for
member)
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
SOLUTION
MENU ANALYSIS CONTACT DQLab Pilot class – Data analyst
Thank
you