Skip to content

Instantly share code, notes, and snippets.

@devinsays
Last active August 16, 2021 12:01
Show Gist options
  • Save devinsays/ee3a18cccb4b77a80f36d35994ab0585 to your computer and use it in GitHub Desktop.
Save devinsays/ee3a18cccb4b77a80f36d35994ab0585 to your computer and use it in GitHub Desktop.
WooCommerce MySQL Challenge

Here's a couple MySQL challenges. No tricks or gotchas, just straightforward MySQL queries.

We generally use TablePlus when making SQL queries, but you can also use the command line or whatever you're most comfortable with.

Here's an example query to get all orders on WooCommerce site:

SELECT
	*
FROM
	wp_posts orders
WHERE
	orders.post_type = 'shop_order';

Here's the challenge questions:

  1. Get the order ids for all orders that have a shipping state of "New Jersey".
  2. Get the order ids for all orders that have shipping state of "New Jersey" and were created in the year 2021 (gmt).
  3. Get the order ids and billing totals for all orders created in 2021 that have a billing total higher or equal to $100.
  4. Update the tax status (_tax_status) to "none" for products with an ID of 100, 101 or 102.

Email the answers back when you've completed the challenge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment