SELECT
COUNT(DISTINCT SUBSTRING(seats.seat_no FROM '^[0-9]+')) AS rows_count,
COUNT(seats.aircraft_code) AS seats_count FROM aircrafts_data
JOIN seats USING (aircraft_code)
WHERE aircrafts_data.model->>'en' = 'Boeing 777-300';
GROUP BY seats.aircraft_code