Company: Service now_26oct
Difficulty: medium
Problem Description As part of a summary report on advertising campaigns, you are tasked with calculating the profit share of each company within its operating country and presenting the results in a pivoted format. You must calculate the total profit for each company and the overall total profit for each country. Profit is defined as the total difference between campaign revenue and expenses . The result should display each company's name alongside its profit share, pivoted so that each distinct country becomes its own column. Schema companies table: id (SMALLINT): Primary key. The ID of the company. name (VARCHAR(255)): The name of the company. country (VARCHAR(255)): The country where the company operates. campaigns table: company_id (SMALLINT): Foreign key referencing companies.id . expenses (DECIMAL(7,2)): The cost expenses of the campaign. revenue (DECIMAL(7,2)): The revenue generated by the campaign. Required Output The result set should contain the following columns: name : The