How can I query by node title? In Drupal 7 I had this code to query node fields and its respective title:
$query = db_select('node', 'n');
$query-&gt;join('field_data_field_internal_institute_paper_i', 'iipi', 'n.nid = iipi.entity_id');
$query-&gt;fields('n', array('nid'));
// some other conditions
$query-&gt;fields('n', array('title')); // &lt;- working fine for D7
$result = $query-&gt;execute()-&gt;fetchall();

which was working fine. I know imported to D9 and I need to rewrite this accordingly:
$db = \Drupal::database();
$query = $db-&gt;select('node', 'n');
$query-&gt;join('node_revision__field_internal_institute_paper_i', 'iipi', 'n.nid = iipi.entity_id');
$query-&gt;fields('n', array('nid'));
// some other conditions
$query-&gt;fields('n', array('title')); //&lt;- not working for D9
$result = $query-&gt;execute()-&gt;fetchall();

for some reason array('title') isn't a field anymore as seen above. How can I get the title here?
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)