BigQuery
BigQuery is a cloud-based data analytics service provided by the Google Cloud Platform (GCP). It stands as one of the many offerings within GCP designed to enable the management, analysis, and extraction of insights from data with scalability and high-speed capabilities. Functioning as a data warehouse, BigQuery is adept at storing and managing large and diverse volumes of data from various sources. It leverages distribution techniques and parallel processing to facilitate fast and efficient data querying. Users can execute SQL queries to analyze data, generate reports, and gain insights based on analytical inquiries.
In this portfolio section, I will present a variety of queries aimed at addressing business inquiries using the BigQuery software. The questions and datasets utilized in this context are sourced from the Data Analysis Bootcamp hosted by MySkill.
Task 1. Display Loss-Incurring Transactions Occurring Between 2018 and 2019 in the City of Los Angeles, Sorted by Greatest Loss.
To address this inquiry, data needs to be filtered based on the order year (order_date) and city, with the focus on displaying only Los Angeles data and transactions with negative profits. Below is the query that can be utilized to present this data, along with the resulting output.
From the results, it is discernible that loss-incurring transactions took place in the years 2018 and 2019 in Los Angeles. This dataset serves as an initial point for conducting further analyses to comprehend the patterns and characteristics of these transactions. The first step is to analyze the temporal trends of loss-incurring transactions in Los Angeles during 2018 and 2019. This could involve generating graphs or visualizations to ascertain whether certain months exhibit a higher incidence of loss-incurring transactions.
Furthermore, it’s possible to analyze the most common transaction types associated with these loss cases. Identifying these types may reveal specific patterns related to particular locations, customer types, or influencing factors. Spatial analysis, such as mapping the locations of these loss-incurring transactions in Los Angeles, could reveal geographical patterns linked to regions susceptible to such activities.
By delving deeper into the data, potential causes of these loss-incurring transactions can be identified. This can lead to the development of preventative action recommendations and strategies to mitigate the impact of such transactions in the future. The insights garnered from this analysis can provide invaluable guidance for future security policies and risk mitigation strategies.
Task 2. Display Profitable Transactions Occurring in Q1 2018 in Henderson, Sorted by Greatest Profit.
To display this information, we must filter the data to only show profitable transactions, filter the transaction date (order_date) to display transactions occurring during Q1 of 2018, and limit the results to transactions in the city of Henderson. The query below demonstrates this and provides the outcome.
From the data concerning profitable transactions during Q1 2018 in Henderson, several pertinent findings can be deduced, each of which bears significant implications for business analysis and decision-making. The following aspects can be gleaned from the data:
1. Early-Year Financial Performance: Profitable transactions during Q1 2018 indicate a positive financial standing for businesses or sectors in the city of Henderson at the beginning of the year. This may be attributed to factors like holiday seasons, special events, or prevailing consumption trends in Q1.
2. Growth Potential: The elevated volume of profitable transactions during this period suggests a potential for business growth in Henderson. This may motivate the business team to identify successful strategies from Q1 and harness them for further growth endeavors.
3. Trend and Customer Preference Analysis: By assessing the most prevalent types of products or services resulting in profitable transactions, we can discern trends and customer preferences during Q1 2018. This information aids in designing product offerings aligned with customer needs.
4. Reasons for Performance Changes: Significant fluctuations in profitable transactions compared to preceding or subsequent periods could indicate changes in market behavior or external factors influencing business performance in Henderson.
5. Marketing Evaluation: Should there be a sharp increase in profitable transactions during Q1 2018, further analysis can help determine whether specific marketing campaigns or promotional tactics contributed to this outcome.
6. Enhanced Competitiveness: Notable growth in profitable transactions may signify increased competitiveness within Henderson’s business landscape. This analysis could prompt discussions on maintaining competitive advantage and fostering ongoing innovation.
In this analytical sequence, the subsequent step involves conducting further investigations and delving deeper to comprehend the context underlying these findings. Advanced analytical tools, such as statistical modeling or machine learning, can also aid in identifying more complex relationships influencing business performance in Q1 2018 in Henderson.
Task 3. Display the Best-Selling Products (product_name).
To showcase the best-selling products, we can employ aggregate sum syntax and group by clauses to calculate the quantity sold for each product. The query below demonstrates the presentation of this data, along with the ensuing results.
The table has effectively displayed the sold quantities for each product. From this data, pivotal aspects emerge that contribute to analysis and decision-making. The following key insights can be gleaned from the data:
1. Top-Performing Products: By analyzing sold quantities, we discern products that exhibit the highest sales performance. This information aids in recognizing market-popular products that significantly contribute to revenue.
2. Product Performance Comparison: A comparative analysis of sold quantities across various products affords insights into their relative performances within the portfolio. This facilitates identification of high-demand products with growth potential.
3. Popularity Trends: Tracking changes in sold quantities over time reveals product popularity trends. Such insights are invaluable for devising marketing strategies and inventory management in response to demand fluctuations.
4. Product Associations: Scrutinizing sold quantities of related or frequently co-purchased products unveils correlations in customer transactions. This insight guides cross-selling strategies or bundled offerings.
5. Seasonal Analysis: By assessing sold quantities over different time periods, seasonal demand patterns can be identified. This guides targeted marketing campaigns or promotions during specific periods.
6. Inventory Planning: Through sold quantity analysis, efficient inventory management and stocking strategies can be planned. This insight prevents stockouts or excessive inventory accumulation.
7. Consumer Behavior Insights: This data provides insights into consumer preferences, such as favored product types or demand trends. This informs more tailored marketing strategies aligned with customer needs.
8. Product Profitability Analysis: Comparing sold quantities with product profit margins enables measurement of individual product profitability. This aids in identifying products with the highest contribution to profits.
With deeper analysis through appropriate analytical tools, more intricate correlations can be identified between factors such as price, promotions, or external influences, and sold quantities. These insights provide valuable guidance for informed business decisions and the development of effective sales strategies.
Get Dewi Safitri’s stories in your inbox
Join Medium for free to get updates from this writer.
Task 4. Display the Most Unprofitable Products in 2017.
To exhibit the most unprofitable products in 2017, we can filter data based on profit and transaction dates (order_date), focusing solely on transactions with profit < 0 occurring in the year 2017. The query below demonstrates this approach and provides the executed outcome.
From this data, several important insights can be extracted to inform analysis and decision-making. The following facets are discernible from the data:
1. Ineffectual Products: This dataset identifies products that had adverse impacts on business during 2017. It encompasses products that faced poor sales or potentially led to operational losses.
2. Marketing Strategy Evaluation: By analyzing unprofitable products, an evaluation of the efficacy of marketing strategies implemented in 2017 is possible. Consider identifying products struggling to attract customer interest or convey product value effectively.
3. Root Causes of Loss: Further analysis can ascertain reasons behind the unprofitability of these products. Factors such as excessive pricing, quality issues, or market competition may contribute to the products’ underperformance.
4. Segmentation and Targeting: Understanding unprofitable products aids in identifying customer segments unresponsive to these products. This presents opportunities to revisit segmentation and targeting strategies.
5. Quality Evaluation: This data prompts a deeper evaluation of the quality of unprofitable products. Thorough examination and testing might be necessary to identify potential issues.
6. Strategic Shifts: In light of these findings, there’s an opportunity to contemplate restructuring or adjusting product strategies. This might involve price changes, quality improvements, or discontinuation of unprofitable products.
7. Portfolio Diversification: The results of this analysis stimulate thoughts on product portfolio diversification. Identifying unprofitable products informs decisions about introducing new products or allocating more resources to successful ones.
8. Enhanced Customer Research: This data encourages intensified customer research to understand why these products underperformed. Gathering customer feedback and analyzing their preferences informs future product enhancements.
Through further analysis and investigation, deeper insights into factors influencing these products’ poor performance can be obtained, allowing the formulation of more effective improvement strategies.
Task 5. Display a List of Customers with Transactions Exceeding $10,000 along with Transaction Values.
To present this data, we shall filter the data based on the value obtained from the aggregate sum function applied to sales as the transaction value. Subsequently, we will display only those entries with transaction values surpassing $10,000. The following query outlines this procedure.
Aside from the aforementioned method, we can also utilize Common Table Expression (CTE). A Common Table Expression (CTE) is a SQL concept used to create and manage temporary result sets or subqueries that can be utilized within one or several SQL queries. CTE offers a more structured and organized approach for composing complex queries, enhancing the readability and maintenance of SQL code.
For this task, we will create a CTE to group customers with transaction values exceeding $10,000 as “rich_customer”. The following query illustrates this approach.
Here are the executed results using both the initial method and the CTE approach.
Task 6. Calculate the Average Transaction Value from the List of Customers in Task 1.
Based on the preceding data, our next step is to calculate the average transaction value from the mentioned customer list. The approach involves using the aggregate average function applied to the transaction values within the designated customer group. The following query illustrates this procedure, along with the results.
Task 7. Display a List of Customers with Transaction Values Exceeding the Average (Task 2).
Derived from the calculated average transaction value, we shall then display customer data from this group with transaction values surpassing the computed average. The following query can be employed for this purpose.
From this dataset, we can derive invaluable insights that contribute to business analysis and decision-making. The following are some pertinent pieces of information gleaned from this data:
1. Most Contributing Customers: By analyzing customers with transaction values exceeding $10,000, we can identify the customers that significantly contribute to the company’s revenue. This aids in recognizing pivotal customers worthy of special attention or incentives.
2. Customer Segmentation: Through this data, we can discern characteristics and behaviors of customers conducting transactions beyond $10,000. This facilitates the development of more refined and focused segmentation strategies to cater to diverse customer needs.
3. Preferred Products and Services: Analyzing products or services purchased by high transaction value customers unveils those most preferred by this customer segment. This information enhances marketing and product offering strategies.
4. Relationships and Cross-Selling Opportunities: This data sheds light on potential associations between products or services purchased by high transaction value customers, opening avenues for more effective cross-selling strategies.
5. Consumption Trends: By observing transactions exceeding $10,000 over time, consumption trends influencing future customer purchases can be identified. This aids in marketing strategy planning and inventory management.
6. Customer Loyalty: The data assists in measuring customer loyalty, particularly if high transaction value customers are repeat purchasers. This information can be utilized for developing loyalty programs or customer incentives.
Through further analysis and integration with additional datasets, more profound insights and specific information about high transaction value customers can be attained. These insights serve as the foundation for crafting smarter marketing strategies and improved decision-making.









