'SQL Error [1064] [42000]: You have an error in your SQL syntax while running query

While I am trying to select a table on a MySQL data base, I am getting the following error:

SQL Error [1064] [42000]: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table_1 as (

    SELECT
        user_id,
        age
    FROM example_table

)

S' at line 3

Error position: line: 2

Below I included the query:

WITH

table_1 as (

    SELECT
        user_id,
        age
    FROM example_table

)

SELECT * FROM table_1;

I checked different contributions on StackOverflow and other sites (like ERROR 1064 (42000) and Fix ERROR 1064 (42000) while creating a database in MySQL? ). I am aware there is some syntax error but I am not able to find a solution.

Help is really appreciated



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source