MAQL is not the same as SQL. SQL is a general-purpose database language for reading and writing data. In its most common usage, MAQL focuses on reading data only from a project through the GoodData Portal. This section describes some elementary yet important distinctions.
Suppose you are interested in sales data from your database. In SQL, the query might be the following:
SELECT SUM(Amount) FROM sales_data;
>1 000 000
You have sold a $1,000,000 worth of products. Now, suppose you need to know how much of that data is generated from shoe sales. In SQL:
SELECT SUM(amount) FROM sales_data JOIN product_data ON sales_data.product_type_id=product_data.product_type_id WHERE product_data.name = "shoes";
To understand how to build this second query, you must have command over the following:
- understanding of table and column as database concepts
- familiarity with relational algebra
- understanding how and where your data is stored in the database in order to query it
MAQL takes on a different approach. You don't need to know where and how your data is stored. The equivalent of the first query above is the following in MAQL:
Note that FROM sales_data is not necessary. All relevant amounts are summed from the appropriate table in the datastore. Through the GoodData Portal, you can execute queries without understanding the details of how the data is actually stored in the database.
The equivalent of the second query is the following in MAQL:
SELECT SUM(Amount) WHERE Product Type = shoes
There is no need for remembering table names (where) or figuring out table joins (how). You just simply focus on what you want to get from MAQL.
At the technical level, the GoodData Platform separates the way data is stored in the database (physical data model) from the way the data objects related to each other (logical data model). Project developers create the logical data model through a simple, graphical interface, and when the model is published to a project, the physical data model is created or updated accordingly.