Retrieve the top 3 most ordered dishes from the past 6 months. 

   
   

Output:

+---------+-----------+
| dish_id | num_order |
+---------+-----------+
|     101 |         6 |
|     105 |         6 |
|     102 |         5 |
+---------+-----------+
by

MySQL online editor

Write, Run & Share MySQL queries online using OneCompiler's MySQL online editor and compiler for free. It's one of the robust, feature-rich online editor and compiler for MySQL. Getting started with the OneCompiler's MySQL editor is really simple and pretty fast. The editor shows sample boilerplate code when you choose language as 'MySQL' and start writing queries to learn and test online without worrying about tedious process of installation.

About MySQL

MySQL is a open-source, free and very popular relational database management system which is developed, distributed and supported by Oracle corporation.

Key Features:

  • Open-source relational database management systems.
  • Reliable, very fast and easy to use database server.
  • Works on client-server model.
  • Highly Secure and Scalable
  • High Performance
  • High productivity as it uses stored procedures, triggers, views to write a highly productive code.
  • Supports large databases efficiently.
  • Supports many operating systems like Linux*,CentOS*, Solaris*,Ubuntu*,Windows*, MacOS*,FreeBSD* and others.

Syntax help

Commands

1. CREATE


Example


2. ALTER


Example


3. TRUNCATE


4. DROP


5. RENAME


6. COMMENT

Single-Line Comments:


Multi-Line comments:


DML Commands

1. INSERT


Note: Column names are optional.

Example


2. SELECT


Example


3. UPDATE


Example


4. DELETE


Example


Indexes

1. CREATE INDEX


  • To Create Unique index:

2. DROP INDEX


Views

1. Create a View


2. How to call view


3. Altering a View


4. Deleting a View


Triggers

1. Create a Trigger


2. Drop a Trigger


Stored Procedures

1. Create a Stored Procedure


2. How to call Stored procedure


3. How to delete stored procedure


Joins

1. INNER JOIN


2. LEFT JOIN


3. RIGHT JOIN


4. CROSS JOIN



© Copyright 2025 One Compiler Pvt. Ltd. | Privacy Policy | Terms & Conditions