Problem Statement
You are given 4 JSON files named products, reviews, users, transactions that contains information about various products sold by an e-commerce company, user information, reviews written by users and all transactions made on the products.
Your task is to develop a SQL query engine that can execute SQL queries on JSON data. The engine is expected to handle the following types of queries -
	•	SELECT
	•	WHERE
	•	JOIN (INNER type only)
	•	GROUP BY
	•	ORDER BY
	•	LIMIT
	•	Aggregate functions (COUNT(*), AVG, SUM, MIN, MAX)
	•	
The SQL query will be provided as input will always follow the syntax below. The way to read the syntax definition is - square brackets [ ] indicate optional presence of that element in the query and curly braces { } indicates mandatory where applicable. Pipe | separated values indicates any one of the options. ... indicates one or many such elements can exist.

`SELECT 
    {table_alias | join_table_alias}.col_name AS column_alias, 
    … 
FROM table table_alias 
[ JOIN table join_table_alias on joinexpr [AND joinexpr ... ] ] … 
[WHERE expr [AND expr ... ] ] 
[GROUP BY {table_alias.col_name, … }] 
ORDER BY {column_alias, … } { ASC | DESC } 
[LIMIT n]`

The joinexpr in JOIN can have multiple conditions, however it will be always AND clauses. One condition will always be of form below,

`{table_alias | join_table_alias}.col_name = {value | {table_alias | join_table_alias}.col_name}}`
The expr in WHERE can have multiple conditions, however it will be always AND clauses. One condition will always be of form below,

`{table_alias | join_table_alias}.col_name {operator} {value}`
The supported operators in WHERE expr for the engine are the ones below only:
	•	= (equals)
	•	<> (not equals)
	•	> (greater than)
	•	>= (greater than or equal to )
	•	< (less than)
	•	<= (less than or equal to)

Supported aggregations:
	1	COUNT(*)
	◦	provides the count of rows in the result set.
	◦	Result must be integer type
	2	SUM( {table_alias|join_table_alias}.col_name )
	◦	Only one column supported
	◦	For Double column, result must be rounded to 2 decimal places and always have 2 decimal places
	3	AVG( {table_alias|join_table_alias}.col_name )
	◦	Only one column supported
	◦	For Double column, result must be rounded to 2 decimal places and always have 2 decimal places
	4	MIN( {table_alias|join_table_alias}.col_name )
	◦	Only one column supported
	◦	For Double column, result must be rounded to 2 decimal places and always have 2 decimal places
	5	MAX( {table_alias|join_table_alias}.col_name )
	◦	Only one column supported
	◦	For Double column, result must be rounded to 2 decimal places and always have 2 decimal places
The engine will be tested with four JSON files: products, reviews, users, transactions with each file representing a table name.

Input Format

Data Files
Data Files are available in your program current directory :
	•	products_public.json
	•	users_public.json
	•	reviews_public.json
	•	transactions_public.json

Sample Input
The input will be the below string available in standard input:
SELECT p.id AS product_id, p.name AS product_name FROM products p WHERE p.price > 10.00 ORDER BY product_id ASC

Reading the Input
You can read the input SQL query as standard input.
To read the data files (e.g. products_public.json, user_public.json ... etc) , you can use some of the below code snippets:

Python
` //read from standard input line = input()
// Get the current directory  current_directory = os.getcwd()  // Get all files in the directory  files = os.listdir(current_directory)  `

Constraints
Product attributes:
	•	id: Unique product id, type: int32, constraint: unique in file
	•	name: Product name, type: string, constraint: none
	•	category: Product category, type: string, constraint: none
	•	price: Price of the product, type: double, constraint: positive with 2 decimal precision
User attributes:
	•	user_id: Unique user id, type: int32, constraint: unique in file
	•	name: User name, type: string, constraint: none
	•	age: Age of the user, type: int32, constraint: positive number
	•	location: City of the user, type: string, constraint: none
Review attributes:
	•	product_id: Id of product, type: int32, constraint: part of unique key in file
	•	user_id: Id of user, type: int32, constraint: part of unique key in file
	•	rating: Rating by user, type: int32, constraint: 0 - 5 both inclusive
	•	comment: Comment by user, type: string, constraint: none
Transaction attributes:
	•	transaction_id: Unique id of transaction, type: int32, constraint: unique in file
	•	product_id: Id of product, type: int32, constraint: none
	•	user_id: Id of user, type: int32, constraint: none
	•	price: Price at which 1 unit of product was sold, type: double, constraint: positive with 2 decimal precision
	•	quantity: Total units bought, type: int32, constraint: positive number
	•	date: Date when transaction happened, type: string, constraint: format YYYY-MM-DD
	•	total_amount: Quantity * price, type: double, constraint: always greater than 0

Output Format
Guidelines
	•	The output must be a string
	•	Since we expect several rows and columns, essentially a tabular output, please use comma separator with no spaces before and after to separate out columns and line separator \n to separate out rows.
	•	the first line of the output must be the column names expected in the result, separated by comma with no spaces before and after. The order of the column names also matters and must match with what is provided in SQL query input.

Make an AST and make sure to think of alias 
also use this [json.loads(line) for line in f]