1._rowid 类似Oracle的rowid mysql> ; +-------+----+----------------+-------------+---------------+------------+ | rowid | ID | Name | CountryCode | District | Population | +-------+----+----------------+-------------+---------------+------------+ | | | K…
1.MySQL的历史,一些相关概念. 2.MySQL数据类型 *通常一个页内可以存放尽可能多的行,那么数据库的性能就越好,选择一个正确的数据类型至关重要. 1>UNSIGNED类型: 将数字类型无符号化. 2>ZEROFILL: 可以格式化整形显示,一旦启用该属性,MySQL数据库为列自动添加UNSIGNED属性.0填充. 3>日期和时间类型 日期数据类型占用空间的情况 类型 起始范围 结束范围 DATETIME 1000-01-01 00:00:00 9999-12-31 23:59:…
对数据类型的选择将影响与数据库交互的应用程序的性能. 1.通常来说,如果一个页内可以存放尽可能多的行,那么数据库的性能就越好,因此选择一个正确的数据类型至关重要. 2.另一方面,如果在数据库中创建表时选择了错误的数据类型,那么后期的维护成本可能非常大,用户需要花大量时间进行ALTER TABLE 操作. 1. 数据类型 1. UNSIGNED 将数字类型无符号化. 例如: INT 的类型范围是 -2147483648 ~ 2147483647 INT UNSIGNED 的 类型范围是 0 ~ 4…
1 PL/pgSQL Under the Hood This part discusses some implementation details that are frequently important for PL/pgSQL users to know. 1.1 Variable Substitution SQL statements and expressions within a PL/pgSQL function can refer to variables and paramet…
Cursors Rather than executing a whole query at once, it is possible to set up a cursor that encapsulates the query, and then read the query result a few rows at a time. A more interesting usage is to return a reference to a cursor that a function has…
Control Structures of PL/SQL Control structures are probably the most useful (and important) part of PL/pgSQL.With PL/pgSQL's control structures, you can manipulate PostgreSQL data in a very flexible and powerful way. 1.Returning From a Function RETU…
1.Structure of PL/pgSQL The structure of PL/pgSQL is like below: [ <<label>> ] [ DECLARE declarations ] BEGIN statements END [ label ]; A label is only needed if you want to identify the block for use in an EXIT statement, or to qualify the na…
Trigger Procedures PL/pgSQL can be used to define trigger procedures on data changes or database events. A trigger procedure is created with the CREATE FUNCTION command, declaring it as a function with no arguments and a return type of trigger (for d…
Errors and Messages 1. Reporting Errors and Messages Use the RAISE statement to report messages and raise errors. RAISE [ level ] 'format' [, expression [, ... ]] [ USING option = expression [, ... ] ]; RAISE [ level ] condition_name [ USING option =…
MySQL基础之事务编程学习笔记 在学习<MySQL技术内幕:SQL编程>一书,并做了笔记.本博客内容是自己学了<MySQL技术内幕:SQL编程>事务编程一章之后,根据自己的理解做的笔记,内容和书本并不一致,不过书本实验都经过自己验证,基于MySQL5.7版本.做笔记的目的是方便自己复习,同时分享出来或许对其他人或许有点帮助 1.事务概述 事务是数据库区别于文件系统的重要特性之一,提到事务肯定会想到事务的4个特性ACID,要保证业务的正常使用,必须保证ACID,ACID表示原子性(…