zoukankan      html  css  js  c++  java
  • 《数据库系统概念》学习笔记之SQL高级应用

    由于很久之前就学过数据库的基本理论了,也做过一些数据库的应用,在实践的过程中发现自己只会利用一些初级的数据库知识,很多高级的概念没听说过,更别提使用了。于是最近开始阅读经典的帆船书,会摘抄一些知识在这里,加强印象。

    1、存储过程

        Developers can write their own functions and procedures,store them in the database, and then invoke themfrom SQL statements.

        Functions are particularly useful with specialized data types such as images and geometric  objects. While such business logic can be encoded as    

        programming-language procedures stored entirely outside the database, defining them as stored procedures in the database has several

        advantages. For example, it allows multiple applications to access the procedures, and it allows a single point of change in case the business rules

        change, without changing other parts of the application. Application code can then call the stored procedures, instead of directly updating database

        relations.

    2、触发器(Triggers)

        Triggers can be used to implement certain integrity constraints that cannot be specified using the constraint mechanism of SQL. Triggers are also

         useful mechanisms for alerting humans or for starting certain tasks automatically when certain conditions are met.

        For backup replica systems that may have to take over from the primary system, triggers would have to be disabled initially,

        and enabled when the backup site takes over processing fromthe primary system.

    3、OLAP

        An online analytical processing (OLAP) system is an interactive system that permits an analyst to view different summaries of multidimensional

        data. The word online indicates that an analyst must be able to request new summaries and get responses online, within a few seconds, and

        should not be forced to wait for a long time to see the result of a query.

    4、高级聚合函数rank和windowing

    Windowing
    select year, avg(num credits)
    over (order by year rows 3 preceding)
    as avg total credits
    from tot credits;
    Rank
    1 select ID, rank () over (order by GPA desc nulls last) as s rank
    2 from student grades;
  • 相关阅读:
    25:最长最短单词
    09:向量点积计算
    08:石头剪刀布
    07:有趣的跳跃
    36:计算多项式的值
    33:计算分数加减表达式的值
    hdu 2289 Cup (二分法)
    Android-补间动画效果
    UVA 586 Instant Complexity
    企业门户(Portal)项目实施方略与开发指南
  • 原文地址:https://www.cnblogs.com/ITEagle/p/2680921.html
Copyright © 2011-2022 走看看