-- Count all stocks

SELECT * FROM symbols;
SELECT COUNT(*) FROM symbols;

-- List all stocks with their respective sectors

SELECT
    s.*,
    sec.sector_name
FROM symbols s 
INNER JOIN sectors sec ON sec.id_sector = s.id_sector
SELECT
    s.id_symbol,
    s.symbol,
    s.symbol_name,
    sec.sector_name,
    s.marketcap,
    s.employees
FROM symbols s 
INNER JOIN sectors sec ON sec.id_sector = s.id_sector

-- Find total stocks per each sectors?

SELECT 
    sec.sector_name,
    COUNT(*) as total_stocks
FROM symbols s 
INNER JOIN sectors sec ON s.id_sector = sec.id_sector
GROUP BY sec.sector_name

-- Find the top 4 sectors with largest companies?

SELECT 
    sec.sector_name,
    COUNT(*) as total_stocks
FROM symbols s 
INNER JOIN sectors sec ON s.id_sector = sec.id_sector
GROUP BY sec.sector_name
ORDER BY total_stocks DESC
SELECT 
    sec.sector_name,
    COUNT(*) as total_stocks
FROM symbols s 
INNER JOIN sectors sec ON s.id_sector = sec.id_sector
GROUP BY sec.sector_name
ORDER BY total_stocks DESC
LIMIT 4