What is wrong with SQL ?
There is nothing wrong with SQL. In fact, it is a powerful language to get insights from your data. Moreover, the concept of a view is an efficient dynamic mechanism to define how your insights are obtained from your data without copying or moving data.
However, this being said, there are some issues with SQL. SQL is based on the Relational Algebra, but does not implement it in a very sound matter. In the Relational Algebra query operations are performed recursively on a relation. The output of these operations is a new relation, which might be formed from one or more input relations.
Colbert implements Relational Algebra in SQL in a way that you can still use normal SQL, but at the same time you benefit from the power and simplicity of a pure Relational Algebra. Colbert achieves this by the recognition that the projection (π) is actual the SQL from and the selection (σ) is actual the SQL where. So what about the SQL Select ? Sql Select is nothing more than the identity operator: It does nothing and can be omitted.
In Colbert you can also omit the superfluous Group By clause: It is obvious when there is an aggregate function, all the non-aggregated columns are Group By fields. Furthermore you might ignore the Having clause: In the Relational Algebra you can just apply where on the aggregated result.
Colbert SQL is called Slim SQL and has more extensions for easy sorting, easy function definition, window functions etc. Slim SQL is more powerful while the current SQL standard is retained.
Generic functions in Slim SQL
Colbert makes defining functions very simple. Just define the expression that you would normally use in calculated columns. When you omit type information Colbert considers it a generic definition and finds out what possible parameter and result types there are.
So when executing
Create func next as X + 1
You can apply the function next to any type that supports addition ( + ) :
Select Name, next Id, next birthdate from Employee
How does it work ?
|Access a table or a view||Select * from Department||Department|
|Select some records||Select * from Department where DepId > 12||Department where DepId > 12|
|Select some columns||Select Name, DepId from Department||Name, DepId from Department|
|Show number of orders per beer||Select Beer, count (*) as "number" FROM Beers group by Beer order by "number" desc;||Beer, count desc as Number from Beers|
|Define a function||Create function mini(v1 number, v2 number) return number |
if v1 < v2 then return v1; else return v2; end if;
|create func mini as a < b ? a : b|
What are the key benefits ?
With Slim SQL you can focus on your problem and overcome the drawbacks of SQL