How can I query by node title?
This works fine in Drupal 9 for titles only from the node_field_data table:
$ drush php
Psy Shell v0.10.4 (PHP 7.4.13 — cli) by Justin Hileman
&gt;&gt;&gt; $db = \Drupal::database();
=&gt; Drupal\Core\Database\Driver\mysql\Connection {#767
     +&quot;_serviceId&quot;: &quot;database&quot;,
   }
&gt;&gt;&gt; $query = $db-&gt;select('node_field_data', 'n');
=&gt; Drupal\Core\Database\Query\Select {#4281}
&gt;&gt;&gt; $query-&gt;fields('n', ['title']);
=&gt; Drupal\Core\Database\Query\Select {#4281}
&gt;&gt;&gt; $result = $query-&gt;execute()-&gt;fetchall();
=&gt; [
     {#4254
       +&quot;title&quot;: &quot;Foo&quot;,
     },
     {#4257
       +&quot;title&quot;: &quot;Bar&quot;,
     },
   ]

Or for only an array of titles use fetchCol():
&gt;&gt;&gt; $result = $query-&gt;execute()-&gt;fetchCol();
=&gt; [
     &quot;Foo&quot;,
     &quot;Bar&quot;,
   ]

Node Field Data table:
mysql&gt; describe node_field_data;
+-------------------------------+------------------+------+-----+---------+-------+
| Field                         | Type             | Null | Key | Default | Extra |
+-------------------------------+------------------+------+-----+---------+-------+
| nid                           | int(10) unsigned | NO   | PRI | NULL    |       |
| vid                           | int(10) unsigned | NO   | MUL | NULL    |       |
| type                          | varchar(32)      | NO   | MUL | NULL    |       |
| langcode                      | varchar(12)      | NO   | PRI | NULL    |       |
| status                        | tinyint(4)       | NO   | MUL | NULL    |       |
| uid                           | int(10) unsigned | NO   | MUL | NULL    |       |
| title                         | varchar(255)     | NO   | MUL | NULL    |       |
| created                       | int(11)          | NO   | MUL | NULL    |       |
| changed                       | int(11)          | NO   | MUL | NULL    |       |
| promote                       | tinyint(4)       | NO   | MUL | NULL    |       |
| sticky                        | tinyint(4)       | NO   |     | NULL    |       |
| default_langcode              | tinyint(4)       | NO   |     | NULL    |       |
| revision_translation_affected | tinyint(4)       | YES  |     | NULL    |       |
+-------------------------------+------------------+------+-----+---------+-------+
13 rows in set (0.00 sec)