w3resource

SQL Exercises: Count all orders of a specific date

SQL Aggregate Functions: Exercise-18 with Solution

Write a SQL statement that counts all orders for a date August 17th, 2012.

Sample table: orders


Sample Solution:

SELECT COUNT(*) 
FROM orders 
WHERE ord_date='2012-08-17';

Output of the Query:

count
2

Explanation:

Syntax of count all order in a specified date

Pictorial presentation:

Count all order in a specified date

Practice Online


Query Visualization:

Duration:

Query visualization of Count all orders of a specific date - Duration

Rows:

Query visualization of Count all orders of a specific date - Rows

Cost:

Query visualization of Count all orders of a specific date - Cost

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a SQL statement to find the highest purchase amount with their ID, for only those salesmen whose ID is within the range 5003 and 5008.
Next: Write a SQL statement that count the number of salesmen for whom a city is specified. Note that there may be spaces or no spaces in the city column if no city is specified.

What is the difficulty level of this exercise?