knex left join code example

Example 1: sql left join

SELECT table1.column1, table2.column2...
FROM table1
LEFT JOIN table2
ON table1.common_field = table2.common_field;

Example 2: knex migration

// best tutorial knex migration
https://www.youtube.com/watch?v=ipAH7lMfq7k
https://www.youtube.com/watch?v=U7GjS3FuSkA

Example 3: knex datatypes

table.increments('id')
  table.string('account_name')
  table.integer('age')
  table.float('age')
  table.decimal('balance', 8, 2)
  table.boolean('is_admin')
  table.date('birthday')
  table.time('created_at')
  table.timestamp('created_at').defaultTo(knex.fn.now())
  table.json('profile')
  table.jsonb('profile')
  table.uuid('id').primary()

Example 4: left join

Matching part from both table and unmatching part from left table.