SQL Queries
SQL Queries
Env: Dev 2
stg_bing_marketplace_campaign_performance_daily: 2
fact_bing_marketplace_campain_perfroms_load 3
fact_bing_campain_perfroms_load: 4
stg_bing_campaign_performance_daily 5
Table structure:
Env: Dev
stg_bing_marketplace_campaign_performance_dail
y:
CREATE TABLE `bing_dev..stg_bing_marketplace_campaign_performance_daily` (
`account_name` text,
`campaign_name` text,
`ad_distribution` text,
`quality_score` text,
`impressions` text,
`clicks` text,
`ctr` text,
`average_cpc` text,
`spend` text,
`top_impression_rate_percent` text,
`absolute_top_impression_rate_percent` text,
`conversions` text,
`conversion_rate` text,
`cost_per_assist` text,
`campaign_id` text,
`source_date` text,
`phone_calls` text,
`impression_lost_to_budget_percent` text,
`impression_lost_to_rank_agg_percent` text,
`campaign_status` text,
`device_type` text,
`campaign_type` text,
`created_on` datetime DEFAULT NULL,
`created_by` text,
`updated_on` text,
`updated_by` text,
`device_enum` text,
`device_description` text
)
fact_bing_marketplace_campain_perfroms_load
CREATE TABLE `bing_dev.fact_bing_marketplace_campain_perfroms_load` (
`id` int NOT NULL DEFAULT '0',
`campaign_id` text,
`campaign_name` text,
`account_name` text,
`clicks` text,
`ctr` text,
`impressions` text,
`conversions` text,
`conversion_rate` text,
`ad_distribution` text,
`quality_score` text,
`average_cpc` text,
`spend` text,
`top_impression_rate_percent` text,
`absolute_top_impression_rate_percent` text,
`cost_per_assist` text,
`phone_calls` text,
`impression_lost_to_budget_percent` text,
`impression_lost_to_rank_agg_percent` text,
`source_date` datetime DEFAULT NULL,
`year` int DEFAULT NULL,
`year_month_int` int DEFAULT NULL,
`month_year` text,
`month` text,
`month_number` int DEFAULT NULL,
`small_month_name` text,
`week_of_month` int DEFAULT NULL,
`day` int DEFAULT NULL,
`day_of_week_number` int DEFAULT NULL,
`day_of_week` text,
`day_of_year` int DEFAULT NULL,
`day_of_week_of_short_name` text,
`quarter` text,
`quarter_number` int DEFAULT NULL,
`year_month` varchar(50) DEFAULT NULL,
`year_quarter` varchar(50) DEFAULT NULL,
`year_week` varchar(50) DEFAULT NULL,
`created_on` datetime DEFAULT CURRENT_TIMESTAMP,
`created_by` varchar(50) DEFAULT NULL,
`updated_on` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`updated_by` varchar(50) DEFAULT NULL,
`campaign_status` text,
`device_type` text,
`campaign_type` text,
`device_description` text,
`device_enum` text
)
fact_bing_campain_perfroms_load:
CREATE TABLE `bing_dev.fact_bing_campain_perfroms_load` (
`id` int NOT NULL AUTO_INCREMENT,
`campaign_id` text,
`campaign_name` text,
`account_name` text,
`clicks` text,
`ctr` text,
`impressions` text,
`conversions` text,
`conversion_rate` text,
`ad_distribution` text,
`quality_score` text,
`average_cpc` text,
`spend` text,
`top_impression_rate_percent` text,
`absolute_top_impression_rate_percent` text,
`cost_per_assist` text,
`phone_calls` text,
`impression_lost_to_budget_percent` text,
`impression_lost_to_rank_agg_percent` text,
`source_date` datetime DEFAULT NULL,
`year` int DEFAULT NULL,
`year_month_int` int DEFAULT NULL,
`month_year` text,
`month` text,
`month_number` int DEFAULT NULL,
`small_month_name` text,
`week_of_month` int DEFAULT NULL,
`day` int DEFAULT NULL,
`day_of_week_number` int DEFAULT NULL,
`day_of_week` text,
`day_of_year` int DEFAULT NULL,
`day_of_week_of_short_name` text,
`quarter` text,
`quarter_number` int DEFAULT NULL,
`year_month` varchar(50) DEFAULT NULL,
`year_quarter` varchar(50) DEFAULT NULL,
`year_week` varchar(50) DEFAULT NULL,
`created_on` datetime DEFAULT CURRENT_TIMESTAMP,
`created_by` varchar(50) DEFAULT NULL,
`updated_on` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`updated_by` varchar(50) DEFAULT NULL,
`campaign_status` text,
`device_type` text,
`campaign_type` text,
`device_description` text,
`device_enum` text,
PRIMARY KEY (`id`)
)
stg_bing_campaign_performance_daily
CREATE TABLE `bing_dev.stg_bing_campaign_performance_daily` (
`account_name` text,
`campaign_name` text,
`ad_distribution` text,
`quality_score` text,
`impressions` text,
`clicks` text,
`ctr` text,
`average_cpc` text,
`spend` text,
`top_impression_rate_percent` text,
`absolute_top_impression_rate_percent` text,
`conversions` text,
`conversion_rate` text,
`cost_per_assist` text,
`campaign_id` text,
`source_date` text,
`phone_calls` text,
`impression_lost_to_budget_percent` text,
`impression_lost_to_rank_agg_percent` text,
`campaign_status` text,
`device_type` text,
`campaign_type` text,
`created_on` datetime DEFAULT NULL,
`created_by` text,
`updated_on` text,
`updated_by` text,
`device_enum` text,
`device_description` text
)