Code the tables statement to produce a multi-level frequency?



Code the tables statement to produce a multi-level frequency?..

Answer / Amit Kumar Chaurasia

To create a multi-level frequency in SQL, you can use multiple self-joins or common table expressions (CTEs). Here's an example using CTEs for a simple multi-level frequency over two categories:

WITH
categories AS (
SELECT category1, COUNT(*) AS freq1
FROM your_table
GROUP BY category1
),
subcategories AS (
SELECT category1, category2, COUNT(*) AS freq2
FROM categories JOIN your_table ON your_table.category1 = categories.category1
GROUP BY category1, category2
)
SELECT * FROM subcategories;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Warehouse General Interview Questions

Explain in simple terms, the concept of Data Mining.

3 Answers  


What are the steps of implementing data warehousing?

1 Answers  


What are the different types of datawarehosuing?

1 Answers  


What are the data marts?

1 Answers  


What is a core dimension?

1 Answers  


How to calculate fact table granularity?

1 Answers  


Code the tables statement for a single-level (most common) frequency?

1 Answers  


What is BCP?

1 Answers  


Explain Process flow in data warehouse??

1 Answers   BirlaSoft,


What is the data type of the surrogate key?

1 Answers  


Can any one explain about core dimension, balanced dimension, and dirty dimension?

1 Answers  


What is the difference between snowflake and star schema?

1 Answers  


Categories