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: Qual é o valor mediano de investimento por rodada para empresas fundadas nos últimos 3 anos?
 ###Tabelas: 
CREATE TABLE investments (company_id INT, round_type TEXT, raised_amount INT); INSERT INTO investments (company_id, round_type, raised_amount) VALUES (1, 'Series A', 5000000); INSERT INTO investments (company_id, round_type, raised_amount) VALUES (2, 'Seed', 1000000); CREATE TABLE companies (id INT, name TEXT, founding_year INT); INSERT INTO companies (id, name, founding_year) VALUES (1, 'Acme Inc', 2020); INSERT INTO companies (id, name, founding_year) VALUES (2, 'Bravo Corp', 2018);
SELECT AVG(raised_amount) as median_investment_per_round FROM (SELECT raised_amount FROM investments JOIN companies ON investments.company_id = companies.id WHERE companies.founding_year >= YEAR(CURRENT_DATE) - 3 ORDER BY raised_amount) AS subquery WHERE ROW_NUMBER() OVER (ORDER BY raised_amount) IN ( (SELECT CEIL(COUNT(*)/2) FROM investments JOIN companies ON investments.company_id = companies.id WHERE companies.founding_year >= YEAR(CURRENT_DATE) - 3) , (SELECT FLOOR(COUNT(*)/2) FROM investments JOIN companies ON investments.company_id = companies.id WHERE companies.founding_year >= YEAR(CURRENT_DATE) - 3) );