由于很久之前就学过数据库的基本理论了,也做过一些数据库的应用,在实践的过程中发现自己只会利用一些初级的数据库知识,很多高级的概念没听说过,更别提使用了。于是最近开始阅读经典的帆船书,会摘抄一些知识在这里,加强印象。
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
Windowingselect year, avg(num credits) over (order by year rows 3 preceding) as avg total credits from tot credits;