ExcelR Assignment Solution for BA and Data Analytics. SQL Assignment 8 - Views in SQL
Автор: VIKAS EduClass
Загружено: 2025-12-06
Просмотров: 1305
Q8. Views in SQL
a. Create a view named product_category_sales that provides insights into sales performance by product category. This view should include the following information:
productLine: The category name of the product (from the ProductLines table).
total_sales: The total revenue generated by products within that category (calculated by summing the orderDetails.quantity * orderDetails.priceEach for each product in the category).
number_of_orders: The total number of orders containing products from that category.
(Hint: Tables to be used: Products, orders, orderdetails and productlines)
The view when read should show the output as:
SQL Query
CREATE VIEW product_category_sales AS
SELECT
pl.productLine,
SUM(od.quantityOrdered * od.priceEach) AS total_sales,
COUNT(DISTINCT o.orderNumber) AS number_of_orders
FROM productlines pl
JOIN products p
ON pl.productLine = p.productLine
JOIN orderdetails od
ON p.productCode = od.productCode
JOIN orders o
ON od.orderNumber = o.orderNumber
GROUP BY pl.productLine;
🔴 SQL Tutorial: Create VIEW for Product Category Sales | SUM, JOIN, COUNT | MySQL Query Explained
Welcome to Vikas Educlass!
In today’s SQL tutorial, you will learn how to create a powerful VIEW in MySQL that shows sales performance by product category.
In this video, we answer:
✅ How to join ProductLines, Products, Orders, and OrderDetails tables
✅ How to calculate total sales using quantityOrdered * priceEach
✅ How to count number of orders using COUNT(DISTINCT orderNumber)
✅ How to build a clean and professional SQL VIEW
This video is perfect for:
🔹 MySQL learners
🔹 Data Analysts
🔹 BI / MIS Executives
🔹 Students preparing for interviews
🔹 SQL beginners who want real-time project examples
What you will learn:
Creating SQL Views
Using SUM() and COUNT()
Using multiple JOINS
Grouping data by category
Understanding real-world sales data queries
If you find this video helpful, don’t forget to:
👍 Like
📝 Comment
🔔 Subscribe to Vikas Educlass for daily SQL, Excel, and Power BI tutorials
✅ Hashtags / Tags (High-ranking SEO Tags)
Tags
sql tutorial, mysql view, create view in sql, sql project example, sql interview question, sql joins tutorial, product category sales view, mysql join example, mysql sum group by, sales analytics sql, sql for beginners, vikas educlass, sql training india, sql orderdetails productlines example, mis reporting sql
Hashtags
#SQL #MySQL #CreateView #DataAnalytics #SQLQuery #MIS #BusinessIntelligence #LearnSQL #VikasEduclass#vikaseduclass
For SQL, Tableau, Excel and PowerBi Videos, watch my playlist and youtube channel link:
/ @vikaseduclass
ExcelR Assignement
SQL ExcelR Assignment Solution
You will get all the solved ExcelR Assignment
Best Youtube Channel is Vikas EduClass
Vikas EduClass
Exceltips and Exceltricks by Vikas Educlass
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: