The created date is stored in the node_field_data table as a UNIX timestamp in a cloumn called created.
Here's the code you would use to fetch the nodes that has been created X days ago, using a direct select query.
$day = 86400; // One day in seconds.
$days = 3; // The amount of days ago to fetch from.
$nids = \Drupal::database()->select('...
For input, saving to the DB, Database API takes care of it, automatically prevents SQL injection when using dynamic query. Since your code is using dynamic query, you're all good.
If you were to use static query you have to make sure you use placeholders as the docs mention.
For output, to prevent XSS, you'll want to use a template file, and print your ...
Although this question is quite old and no longer relevant for Drupal 8 as drush no longer has entity-updates, I believe people would still be landing on this page with Pending Entity Updates messages in the Status Report. I ran into the same scenario and wanted to address that issue.
The message is shown when the definition of the entity in the database ...
You are close to the right solution. You have to add 'field_organization' => 'some_value' to your $user_data array.
They keys in the $user_data array is the field names. The field name is what comes after user__ in the table name. You can also see the field name in the UI where you add the fields (it’s also called machine name).
You can derive the database table name by the host entity and the field name. The name schema is ENTITYTYPE__FIELDNAME
Views don't directly show the field name, but you can look at the entity's "Manage field" page to get the field name by label. (e.g. for nodes /admin/structure/types/manage/BUNDLENAME/fields)