Counting customer orders from a table

Write a SQL query to find the total number of orders for each customer from a table of customer order information.

Problem

Given a table of information about customer orders, write a SQL query to find the total number of orders for each customer.
Table: 
customer_id | order_id | order_date
1 | 1001 | 2019-01-01
1 | 1002 | 2019-01-02
2 | 1003 | 2019-01-03
3 | 1004 | 2019-01-04
3 | 1005 | 2019-01-05
Example input: 
customer_id | order_id | order_date
1 | 1001 | 2019-01-01
1 | 1002 | 2019-01-02
2 | 1003 | 2019-01-03
3 | 1004 | 2019-01-04
3 | 1005 | 2019-01-05
Example output: 
customer_id | num_orders
1 | 2
2 | 1
3 | 2

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by sarastevens
SELECT customer_id, COUNT(order_id) AS num_orders
FROM orders
GROUP BY customer_id;

A.I. Evaluation of the Solution

This solution is complete and solves the problem. It uses a GROUP BY clause to group the orders by customer, and then uses the COUNT function to count the number of orders for each customer.

Evaluated at: 2022-11-15 04:15:37