When I want one value out of a WordPress database, opening phpMyAdmin or hunting for the database password feels like a lot of work. wp db query skips both, because it reads the connection details from wp-config.php itself.
Run it from the WordPress folder and give it a SQL statement:
wp db query 'SELECT option_value FROM wp_options WHERE option_name="home"' --skip-column-names
The output is the bare value, without the ASCII table borders. --skip-column-names is not a WP-CLI option, it is passed on to the mysql client, which is why it works. Leave it out and you get the normal table with headers.
If you have a longer query, keep it in a file and feed it in on standard input:
wp db query < debug.sql
The docs also show a handy check of every table at once: wp db query "CHECK TABLE $(wp db tables | paste -s -d, -);".
Two caveats. The table prefix is not always wp_, so run wp db tables first if a query says the table does not exist. And the command runs whatever you give it, so UPDATE and DELETE change the live database. Make an export with wp db export before you write anything. On a multisite network the --url flag has no effect here: you query another site by using its own prefix, such as wp_2_options.
Further reading: wp db query (WP-CLI handbook)