Seu SlideShare está sendo baixado. ×

# Case 9 and 10. SQL For Data Analysis 4.pptx

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Próximos SlideShares
Common table expressions
Carregando em…3
×

1 de 12 Anúncio

# Case 9 and 10. SQL For Data Analysis 4.pptx

SQL

Anúncio
Anúncio

Anúncio

### Case 9 and 10. SQL For Data Analysis 4.pptx

1. 1. Data Analyst By: Dila Triarini Practice SQL for Data Analysis JOIN THE BEST UPSKILLING COMMUNITY WITH ME at myskill.id/bootcamp FULLSTACK INTENSIVE BOOTCAMP MINI PORTOFOLIO
2. 2. #RintisKarirImpian Course Summary Aggregate Functions Aggregate functions compute a single result from a set of input values. Aggregate functions Description Syntax avg(expression) the average (arithmetic mean) of all non-null input values SELECT AVG(column_name) FROM table_name count(expression) number of input rows for which the value of expression is not null SELECT COUNT(column_name) FROM table_name DISTINCT clause can be used with the COUNT function to count only unique/distinct values of a table SELECT COUNT(DISTINCT column_name) FROM table_name max(expression) maximum value of expression across all non-null input values SELECT MAX(column_name) FROM table_name min(expression) Minimum value of expression across all non-null input values SELECT MIN(column_name) FROM table_name sum(expression) sum of expression across all non-null input values SELECT SUM(column_name) FROM table_name
3. 3. #RintisKarirImpian Course Summary GROUP BY Clause The PostgreSQL GROUP BY clause is used to divide rows returned by SELECT statement into different groups.(https://www.geeksforgeeks.org/postgresql-group-by-clause/) . Aggregate functions are commonly combined with GROUP BY to group/categorized data based on one or more rows Syntax Example SELECT column_1, column_2, computing_function(column_3) FROM table_name GROUP BY column_1, column_2;
4. 4. #RintisKarirImpian Course Summary HAVING Clause The HAVING clause specifies a search condition for a group or an aggregate. The HAVING clause is often used with the GROUP BY clause to filter groups or aggregates based on a specified condition (https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-having/). Syntax Example SELECT column1, aggregate_function (column2) FROM table_name GROUP BY column1 HAVING condition;
5. 5. #RintisKarirImpian Case Study 1. What is the best selling product based on its selling quantity?
6. 6. #RintisKarirImpian Case Study 3. Consumer named Joel Eaton ask for transaction recap related to product name and its quantity which he have bought in Tokopaedi. Please create the transaction recap!
7. 7. #RintisKarirImpian Case Study 4. When did Tokopaedi receive the most orders?
8. 8. #RintisKarirImpian Case Study 2. You need to give a promotion to 100 individual consumers (segment = ‘Consumer’) with the highest order average. Please create the list of those consumer!
9. 9. #RintisKarirImpian Case Study 5. What product does have the most average profit per unit?
10. 10. #RintisKarirImpian Course Summary SQL Join Aggregate functions compute a single result from a set of input values.
11. 11. #RintisKarirImpian Case Study 1. [tokopaedi] Please create list of consumer with average spending per transaction is higher than average spending all consumer! There are 291 customer with average spending per transaction higher than the average spending all consumer
12. 12. Follow me! Instagram : dilatriarini Twitter : dilatriarini LinkedIn : Dila Triarini Bootcamp Data Analysis by @myskill.id