How to retrieve node body from nid with an SQL query in Drupal 7? From this question I learned that I have to look in field_data_body to retrieve the body of a node from a database. 

field_data_body does not have an nid field though.

What query can I use to retrieve the body from an nid?

To clarify: I simply wanted to quickly fetch a text from a database dump without installing the dump on an actual site. So not looking for PHP here.
field_data_body does not have an nid field though.


Because a field can be attached to any entity, which may have a different primary key than nid.

If you really must use direct SQL, you can query the field like this

SELECT body_value FROM field_data_body WHERE entity_type = 'node' AND entity_id = 1

However, this bypasses several of Drupal's layers, so it's normally strongly discouraged to use direct queries.

Instead, it's better to 

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'node')
  -&gt;propertyCondition('status', NODE_PUBLISHED)
  -&gt;propertyCondition('nid', 1)
;
$result = $query-&gt;execute();

$nodes = node_load_multiple(array_keys($result['node']));

foreach ($nodes as $node) {
  $bodies = field_get_items('node', $node, 'body');
  foreach ($bodies as $body) {
    var_dump($body['safe_value']);
  }
}


The EFQ version have several advantages


It's safe. You can't (easily) accidentally open injection attacks.
It outputs a safely escaped value, avoiding XSS attacks.
It works if a node has multiple values for the body field.
It works on sites with multiple languages.