Journal Entry, July 12th to July 19th 2019

July 19, 2019 · 1 min read

MySQL

  1. Mon Jul 15 2019

    • Json field queries

      SELECT
          *, `payload`->"$[0].eCommerceOrderId" AS `e_commerce_order_id`
      FROM
          pendingOrderStatus
      WHERE
          `status` = 'sent';
      SELECT
          id, `order`->>'$.e_commerce_order_id' AS `e_commerce_order_id`
      FROM
          order_log_transforms
      WHERE
          `order`->>'$.e_commerce_order_id' IS NOT NULL;
  2. Wed Jul 17 2019

    • Importing from the source table in one database to the destination in another database.

      INSERT INTO `materials-staging`.`files` (`id`, `path`, `type`, `hash`, `material_id`, `active`, `created_at`, `updated_at`, `deleted_at`)
      SELECT
          *
      FROM
          `materials_staging`.`mat_files`;