Skip to content

Instantly share code, notes, and snippets.

@acstrahl
Created October 2, 2024 20:46
Show Gist options
  • Save acstrahl/383438bfb27ab6db7f14c607e6dc32a1 to your computer and use it in GitHub Desktop.
Save acstrahl/383438bfb27ab6db7f14c607e6dc32a1 to your computer and use it in GitHub Desktop.
Dataquest Customers and Products Analysis Using SQL Project
-- Customers and Products Analysis Project
-- First, let's look at the count of rows and columns for each table in the database:
SELECT 'Customers' AS table_name,
13 AS number_of_attribute,
COUNT(*) AS number_of_row
FROM Customers
UNION ALL
SELECT 'Products' AS table_name,
9 AS number_of_attribute,
COUNT(*) AS number_of_row
FROM Products
UNION ALL
SELECT 'ProductLines' AS table_name,
4 AS number_of_attribute,
COUNT(*) AS number_of_row
FROM ProductLines
UNION ALL
SELECT 'Orders' AS table_name,
7 AS number_of_attribute,
COUNT(*) AS number_of_row
FROM Orders
UNION ALL
SELECT 'OrderDetails' AS table_name,
5 AS number_of_attribute,
COUNT(*) AS number_of_row
FROM OrderDetails
UNION ALL
SELECT 'Payments' AS table_name,
4 AS number_of_attribute,
COUNT(*) AS number_of_row
FROM Payments
UNION ALL
SELECT 'Employees' AS table_name,
8 AS number_of_attribute,
COUNT(*) AS number_of_row
FROM Employees
UNION ALL
SELECT 'Offices' AS table_name,
9 AS number_of_attribute,
COUNT(*) AS number_of_row
FROM Offices;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment