Which are the SQL improvements you are waiting for?

后端 未结 30 1240
感情败类
感情败类 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:48

    Something which I call REFERENCE JOIN. It joins two tables together by implicitly using the FOREIGN KEY...REFERENCES constraint between them.

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

    T-SQL Specific: A decent way to select from a result set returned by a stored procedure that doesn't involve putting it into a temporary table or using some obscure function.

    SELECT * FROM EXEC [master].[dbo].[xp_readerrorlog]
    
    0 讨论(0)
  • 2021-02-01 22:52

    Comments for check constraints. With this feature, an application (or the database itself when raising an error) can query the metadata and retrieve that comment to show it to the user.

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

    Ability to define columns based on other columns ad infinitum (including disambiguation).

    This is a contrived example and not a real world case, but I think you'll see where I'm going:

    SELECT LTRIM(t1.a) AS [a.new]
        ,REPLICATE(' ', 20 - LEN([a.new])) + [a.new] AS [a.conformed]
        ,LEN([a.conformed]) as [a.length]
    FROM t1
    INNER JOIN TABLE t2
        ON [a.new] = t2.a
    ORDER BY [a.new]
    

    instead of:

    SELECT LTRIM(t1.a) AS [a.new]
        ,REPLICATE(' ', 20 - LEN(LTRIM(t1.a))) + LTRIM(t1.a) AS [a.conformed]
        ,LEN(REPLICATE(' ', 20 - LEN(LTRIM(t1.a))) + LTRIM(t1.a)) as [a.length]
    FROM t1
    INNER JOIN TABLE t2
        ON LTRIM(t1.a) = t2.a
    ORDER BY LTRIM(t1.a)
    

    Right now, in SQL Server 2005 and up, I would use a CTE and build up in successive layers.

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

    Arrays

    I'm not sure what's holding this back but lack of arrays lead to temp tables and related mess.

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

    Automatic denormalization.

    But I may be dreaming.

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