SQL: 11 - SQL Example: Drupal 8 DB

Given 2 tables

node

nid    vid    type    uuid    langcode
1    1    article    aa17bdd2-2985-497f-be81-3a2b0db33f4b    en
2    2    article    06d1f1cf-a3bf-49ae-a190-7942bcbc8bf3    en
3    3    article    ee53ffc8-c395-427f-9b63-ecbcfe83bae0    en
4    4    article    3b329388-1c78-446f-a480-c66b162bef46    en
5    5    article    0c610060-746a-4f8a-acc8-6851f1929900    en

node_field_data

nid    vid    type    langcode    status    title    uid    created    changed    promote    sticky    revision_translation_affected    default_langcode
1    1    article    en    1    Home    1    1528950146    1528950157    1    0    1    1
2    2    article    en    0    Page1    1    1529046918    1529778699    1    0    1    1
3    3    article    en    0    Page2    1    1529046960    1529778699    1    0    1    1
4    4    article    en    0    Page3    1    1529046967    1529778699    1    0    1    1
5    5    article    en    0    Page4    1    1529046973    1529778699    1    0    1    1

SQL Statement

select
node.nid,
node.type,
node_field_data.title,
node_field_data.created
from node
LEFT OUTER JOIN node_field_data
ON node.nid = node_field_data.nid;

Produces Dataset

nid    type    title    created
1    article    Home    1528950146
2    article    Page1    1529046918
3    article    Page2    1529046960
4    article    Page3    1529046967
5    article    Page4    1529046973
6    article    Page5    1529046981
7    article    Page6    1529046990
8    article    Page7    1529046997
9    article    Page8    1529047004
10    article    Page9    1529047012
Tags