Common Table Expression (CTE) aka WITH clause

Code
-- Common feature in RDBMS, but new in MySQL 8.0, MariaDB 10.2.1

WITH low_price_history (cost, label, status) AS (
  SELECT 
    price,
    name,
    status
  FROM history
  WHERE price < 50
  ORDER BY price
  LIMIT 20
)

SELECT label, cost, status FROM low_price_history
  WHERE label = 'foo';
Result
labelcoststatus
foo9.1354203
foo9.6967503
foo11.8668401
foo12.9706704
foo16.1879102
foo16.4992101
0.0050621032714844 ms (with caching enabled)

Used Versions
PHP 7.4, Zend 3.0, Symfony 4.3, Laravel 5.8, PHPUnit 8.0, Doctrine 2.10