Remove Column 'wholesaler_file_Name' from all table,views and query
Requirement
Introduction: Daily/Monthly/Weekly Sales refers to the total revenue generated from selling goods or services in a single day/month/week. Tracking daily sales is essential for businesses as it helps assess performance, make informed decisions, and spot trends in customer behavior or product demand. This tables helps in identifying which products or services are selling the most. Provides insights into trends, popular items, or seasonal shifts. The number of units sold each day. Indicates demand and customer preferences.
Requirement: Write a SQL query to remove 'wholesaler_file_name' column from the all the tables in unity catalog. Also remove the 'wholesaler_file_name' column including cases where it appears with a trailing comma or without a comma present in SQL query in pre_t1_query and t1_query column from pre_t1_master and t1_master respectively.
Below are table details:
pre_t1_daily_sales
pre_t1_monthly_sales
pre_t1_weekly_sales
r_t1_daily_sales
r_t1_monthly_sales
r_t1_weekly_sales
Prerequisite:
- Drop the tables pre_t1_daily_sales_clone, pre_t1_monthly_sales_clone, pre_t1_weekly_sales_clone, r_t1_daily_sales_clone, r_t1_monthly_sales_clone, r_t1_weekly_sales_clone, pre_t1_master_clone1, and t1_master_clone if they exist.
- Create the replica tables and execute the Requirement by applying changes to pre_t1_daily_sales_clone in place of pre_t1_daily_sales, pre_t1_monthly_sales_clone instead of pre_t1_monthly_sales, and pre_t1_weekly_sales_clone instead of pre_t1_weekly_sales. Similarly, apply the updates to r_t1_daily_sales_clone, r_t1_monthly_sales_clone, and r_t1_weekly_sales_clone as replicas of their respective original tables. Additionally, perform modifications on pre_t1_master_clone1 instead of pre_t1_master and t1_master_clone instead of t1_master.
- SET TBLPROPERTIES ('delta.columnMapping.mode' = 'name') for alter the tables.
Unity Catalog details: All the tables under the schema 'purgo_playground'
Expected Output: Databricks SQL query for alter the tables