Company: Intuit_16_jan
Difficulty: medium
Problem Description You are building a reporting query to improve the functionality of "The Yellow Pages" website. Your task is to return a list of companies, their phone numbers, and their formatted average ratings based on reviews across various categories. Some companies may have a paid promotion status , which gives them special display privileges: They must always appear at the top of the results, regardless of their rating. Their company name must be prefixed with [PROMOTED] . Their actual rating must be completely hidden from the results. Schema companies Column Name Data Type Description id INTEGER Primary Key name VARCHAR Company name phone VARCHAR Company phone number promotion_status BOOLEAN Indicates whether the company has an active paid promotion categories Column Name Data Type Description company_id INTEGER Foreign key mapping to companies.id name VARCHAR Category name where the company is listed review_rating NUMERIC Individual review rating given to the comp