Abaixo está uma instrução que descreve uma tarefa de geração de SQL, combinada com uma entrada que fornece mais contexto sobre os esquemas de tabela disponíveis. Escreva o código SQL que responda adequadamente à solicitação
 ###Instrução: Quais são os gastos totais com P&D e os valores de vendas para cada medicamento, desnormalizados e com uma linha total?
 ###Tabelas: 
CREATE TABLE RnDExpenditures (drug_name VARCHAR(255), rnd_expenditure DECIMAL(10,2)); INSERT INTO RnDExpenditures (drug_name, rnd_expenditure) VALUES ('DrugD', 60000.00), ('DrugE', 80000.00), ('DrugF', 40000.00); CREATE TABLE SalesData (drug_name VARCHAR(255), sales_quantity INT, sales_amount DECIMAL(10,2)); INSERT INTO SalesData (drug_name, sales_quantity, sales_amount) VALUES ('DrugD', 120, 18000.00), ('DrugE', 150, 22500.00), ('DrugF', 75, 10500.00);
SELECT drug_name, 'rnd_expenditure' as metric, SUM(rnd_expenditure) as value FROM RnDExpenditures GROUP BY drug_name UNION ALL SELECT drug_name, 'sales_amount' as metric, SUM(sales_amount) as value FROM SalesData GROUP BY drug_name UNION ALL SELECT 'Total', SUM(value) as value FROM (SELECT drug_name, 'rnd_expenditure' as metric, SUM(rnd_expenditure) as value FROM RnDExpenditures GROUP BY drug_name UNION ALL SELECT drug_name, 'sales_amount' as metric, SUM(sales_amount) as value FROM SalesData GROUP BY drug_name) sub;