clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1305693 fiddles created (20205 in the last week).

select version();
version()
8.0.22
 hidden batch(es)


CREATE TABLE `payments_credit_card` ( `id` int(20) unsigned NOT NULL AUTO_INCREMENT, `payment_id` int(20) unsigned DEFAULT NULL, `transaction_id` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL, `ref_transaction_id` varchar(128) DEFAULT NULL, `auth_code` varchar(16) DEFAULT NULL, `response_message` varchar(128) DEFAULT NULL, `gateway_extra_id` varchar(128) DEFAULT NULL, `first` varchar(128) DEFAULT NULL, `last` varchar(128) DEFAULT NULL, `address` varchar(128) DEFAULT NULL, `address2` varchar(128) DEFAULT NULL, `city` varchar(128) DEFAULT NULL, `state_province` char(64) DEFAULT NULL, `postal_code` varchar(18) DEFAULT NULL, `country_code` char(2) DEFAULT NULL, `card_number` varchar(20) DEFAULT NULL, `card_type` varchar(10) DEFAULT NULL, `card_exp_date` char(4) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `response_code` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `auth_code` (`auth_code`), KEY `card_number` (`card_number`), KEY `ref_transaction_id` (`ref_transaction_id`), KEY `first` (`first`), KEY `last` (`last`), KEY `payment_id` (`payment_id`), KEY `transaction_id` (`transaction_id`) ) ENGINE=InnoDB AUTO_INCREMENT=477148 DEFAULT CHARSET=latin1;
 hidden batch(es)


CREATE TABLE `gateway_fees_stripe` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fee_id` varchar(48) COLLATE utf8_unicode_ci NOT NULL, `organization_id` int(11) NOT NULL, `transaction_id` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL, `amount` decimal(8,2) NOT NULL, `fee_type` enum('fee','refund') COLLATE utf8_unicode_ci NOT NULL, `amount_refunded` decimal(8,2) NOT NULL, `currency` varchar(3) COLLATE utf8_unicode_ci NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, `date_charged` datetime NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `ref_transaction_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `processing_fee_bp` int(11) DEFAULT NULL, `surcharge_fee` decimal(5,2) DEFAULT '0.00', `gateway_stripe_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `fee_id` (`fee_id`), KEY `organization_id` (`organization_id`), KEY `transaction_id` (`transaction_id`), KEY `date_charged` (`date_charged`), KEY `ref_tx_id` (`ref_transaction_id`), KEY `fee_type` (`fee_type`), KEY `gateway_stripe_id` (`gateway_stripe_id`), KEY `organization_id_2` (`organization_id`,`transaction_id`) ) ENGINE=InnoDB AUTO_INCREMENT=21799 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
 hidden batch(es)


CREATE TABLE `payments_credit_card` ( `id` int(20) unsigned NOT NULL AUTO_INCREMENT, `payment_id` int(20) unsigned DEFAULT NULL, `transaction_id` varchar(128) DEFAULT NULL, `ref_transaction_id` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL, `auth_code` varchar(16) DEFAULT NULL, `response_message` varchar(128) DEFAULT NULL, `gateway_extra_id` varchar(128) DEFAULT NULL, `first` varchar(128) DEFAULT NULL, `last` varchar(128) DEFAULT NULL, `address` varchar(128) DEFAULT NULL, `address2` varchar(128) DEFAULT NULL, `city` varchar(128) DEFAULT NULL, `state_province` char(64) DEFAULT NULL, `postal_code` varchar(18) DEFAULT NULL, `country_code` char(2) DEFAULT NULL, `card_number` varchar(20) DEFAULT NULL, `card_type` varchar(10) DEFAULT NULL, `card_exp_date` char(4) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `response_code` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `auth_code` (`auth_code`), KEY `card_number` (`card_number`), KEY `ref_transaction_id` (`ref_transaction_id`), KEY `first` (`first`), KEY `last` (`last`), KEY `payment_id` (`payment_id`), KEY `transaction_id` (`transaction_id`) ) ENGINE=InnoDB AUTO_INCREMENT=477148 DEFAULT CHARSET=latin1;
Table 'payments_credit_card' already exists
 hidden batch(es)


CREATE TABLE `gateway_fees_stripe` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fee_id` varchar(48) COLLATE utf8_unicode_ci NOT NULL, `organization_id` int(11) NOT NULL, `transaction_id` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL, `amount` decimal(8,2) NOT NULL, `fee_type` enum('fee','refund') COLLATE utf8_unicode_ci NOT NULL, `amount_refunded` decimal(8,2) NOT NULL, `currency` varchar(3) COLLATE utf8_unicode_ci NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, `date_charged` datetime NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `ref_transaction_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `processing_fee_bp` int(11) DEFAULT NULL, `surcharge_fee` decimal(5,2) DEFAULT '0.00', `gateway_stripe_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `fee_id` (`fee_id`), KEY `organization_id` (`organization_id`), KEY `transaction_id` (`transaction_id`), KEY `date_charged` (`date_charged`), KEY `ref_tx_id` (`ref_transaction_id`), KEY `fee_type` (`fee_type`), KEY `gateway_stripe_id` (`gateway_stripe_id`), KEY `organization_id_2` (`organization_id`,`transaction_id`) ) ENGINE=InnoDB AUTO_INCREMENT=21799 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Table 'gateway_fees_stripe' already exists
 hidden batch(es)


EXPLAIN SELECT f.transaction_id, a.first FROM gateway_fees_stripe f INNER JOIN payments_credit_card a ON a.`transaction_id` = f.transaction_id WHERE f.organization_id IN (262,252,226) ORDER BY f.transaction_id DESC
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE f index organization_id,transaction_id,organization_id_2 organization_id_2 391 1 100.00 Using where; Using index; Using filesort
1 SIMPLE a ref transaction_id transaction_id 387 db_515436174.f.transaction_id 1 100.00
 hidden batch(es)