Back to questions

Instacart Exploration – Case Study Checkpoint #1 SQL Interview Question

Instacart Exploration – Case Study Checkpoint #1

SQL Interview Question

Explore the data. Here are some questions to investigate:

  • How many items are there?
  • How many different products are in the dataset?

Table Schema

Here are the schemas for all 5 tables in the Instacart market data.

ic_order_products_curr, ic_order_products_prior

These files specify which products were purchased in each Instacart order. ic_order_products_prior contains previous order contents for all customers, and ic_order_products_curr contains current orders; the table fields are the same.

The 'reordered' field indicates that the customer has a previous order that contains the product. Other fields should be self-explanatory.

Column NameType
order_idinteger
product_idinteger
add_to_cart_orderinteger
reorderedinteger boolean (1 or 0)

Notes

  • Some orders will have no reordered items
  • None of these fields are unique to this table, but the combination of order_id and product is unique

ic_products

Column NameType
product_idinteger
product_namestring
aisle_idinteger
department_idinteger

ic_departments

Column NameType
department_idinteger
departmentstring

ic_aisles

Column NameType
aisle_idinteger
aislestring

Data Source

Difficulty

Easy

Input

(PostgreSQL)

Output