php bin/console doctrine:query:sql

Executes arbitrary SQL directly from the command line.

Usage

doctrine:query:sql [--connection CONNECTION] [--depth DEPTH] [--force-fetch] [--] <sql>

Arguments

sql   The SQL statement to execute. 

Options

      --connection    The named database connection 
      --depth         Dumping depth of result set. 
      --force-fetch   Forces fetching the result. 

Help

The doctrine:query:sql command executes the given SQL query and
outputs the results:

php bin/console doctrine:query:sql "SELECT * FROM users"