Which are the SQL improvements you are waiting for?

后端 未结 30 1244
感情败类
感情败类 2021-02-01 22:29

Dealing with SQL shows us some limitations and gives us an opportunity to imagine what could be.

Which improvements to SQL are you waiting for? Which would you put on t

相关标签:
30条回答
  • 2021-02-01 22:55

    Operator to manage range of dates (or numbers):

    where interval(date0, date1) intersects interval(date3, date4) 
    

    EDIT: Date or numbers, of course are the same.

    EDIT 2: It seems Oracle have something to go, the undocumented OVERLAPS predicate. More info here.

    0 讨论(0)
  • 2021-02-01 22:56

    parameterized order by, as in:

    
    select * from tableA order by @columName
    
    0 讨论(0)
  • 2021-02-01 22:59

    More SQL Server than SQL but better integration with Source Control. Preferably SVN rather than VSS.

    0 讨论(0)
  • 2021-02-01 22:59

    String Agregation on Group by (In Oracle is possible with this trick):

    SELECT deptno, string_agg(ename) AS employees
    FROM   emp
    GROUP BY deptno;
    
    DEPTNO EMPLOYEES
    ---------- --------------------------------------------------
        10 CLARK,KING,MILLER
        20 SMITH,FORD,ADAMS,SCOTT,JONES
        30 ALLEN,BLAKE,MARTIN,TURNER,JAMES,WARD
    
    0 讨论(0)
  • 2021-02-01 23:01

    UPSERT or MERGE in PostgreSQL. It's the one feature whose absence just boggles my mind. Postgres has everything else; why can't they get their act together and implement it, even in limited form?

    0 讨论(0)
  • 2021-02-01 23:01

    More OOP features:

    • stored procedures and user functions

      CREATE PROCEDURE tablename.spname ( params ) AS ...

    called via

    EXECUTE spname
    FROM tablename
    WHERE conditions
    ORDER BY
    

    which implicitly passes a cursor or a current record to the SP. (similar to inserted and deleted pseudo-tables)

    • table definitions with inheritance

    table definition as derived from base table, inheriting common columns etc

    Btw, this is not necessarily real OOP, but only syntactic sugar on existing technology, but it would simplify development a lot.

    0 讨论(0)
提交回复
热议问题