IssueRaiser

I think that the biggest problem with SQL is more around the actual syntax of the language and how verbose it feels to write complicated ...

I think that the biggest problem with SQL is more around the actual syntax of the language and how verbose it feels to write complicated queries. I would prefer a syntax layer that can be compiled / transformed back to SQL but that does basic things like having a query start with the tables, then joins, then groupings then the final projection. Also a less cumbersome way to use the "WITH" statement to form named sub-queries. Perhaps something like: SELECT COUNT(*) as columns, column_type, table_name FROM ( SELECT c.id, c.type AS column_type, t.name AS table_name FROM tables t INNER JOIN columns c ON t.id = c.table_id WHERE t.system=false; ) a HAVING COUNT(*) > 1 ORDER BY columns DESC Being re-written as: # Use ":=" to replace WITH for named ephermal views # Replace "WHERE" with "?", "SELECT" with "|>" at the end non_system := tables ? system=false |> name:table_name, is:table_id # Replace INNER JOIN with "*=" non_system_columns := non_system.table_id *= columns.table_id |> c.id, c.type:column_type # GROUP BY columns are automatically generated by non-aggregated columns column_types := non_system_columns |> COUNT(*):columns DESC, column_type, table_name So the final query may look like: non_system := tables ? system=false |> name:table_name, is:table_id non_system_columns := non_system.table_id *= columns.table_id |> c.id, c.type:column_type non_system_columns |> COUNT(*):columns DESC, column_type, table_name Any thoughts on this?

Posted by siganakis on Sep 2, 2014, 1:05 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.9,000 issues0 comments

hackernews (E-commerce)

I think that the biggest problem with SQL is more around the actual syntax of the language and how verbose it feels to write complicated ...

siganakisSep 2, 2014, 1:05 AM

I think that the biggest problem with SQL is more around the actual syntax of the language and how verbose it feels to write complicated queries. I would prefer a syntax layer that can be compiled / transformed back to SQL but that does basic things like having a query start with the tables, then joins, then groupings then the final projection. Also a less cumbersome way to use the "WITH" statement to form named sub-queries. Perhaps something like: SELECT COUNT(*) as columns, column_type, table_name FROM ( SELECT c.id, c.type AS column_type, t.name AS table_name FROM tables t INNER JOIN columns c ON t.id = c.table_id WHERE t.system=false; ) a HAVING COUNT(*) > 1 ORDER BY columns DESC Being re-written as: # Use ":=" to replace WITH for named ephermal views # Replace "WHERE" with "?", "SELECT" with "|>" at the end non_system := tables ? system=false |> name:table_name, is:table_id # Replace INNER JOIN with "*=" non_system_columns := non_system.table_id *= columns.table_id |> c.id, c.type:column_type # GROUP BY columns are automatically generated by non-aggregated columns column_types := non_system_columns |> COUNT(*):columns DESC, column_type, table_name So the final query may look like: non_system := tables ? system=false |> name:table_name, is:table_id non_system_columns := non_system.table_id *= columns.table_id |> c.id, c.type:column_type non_system_columns |> COUNT(*):columns DESC, column_type, table_name Any thoughts on this?

Comments (0)

No comments yet. Start the discussion.

Comment on this issue