通用知识
When a syntax element consists of a number of alternatives, the alternatives are separated by vertical bars (“|”). When one member from a set of choices may be chosen, the alternatives are listed within square brackets (“[” and “]”):
TRIM([[BOTH | LEADING | TRAILING] [remstr] FROM] str)
When one member from a set of choices must be chosen, the alternatives are listed within braces (“{” and “}”):
{DESCRIBE | DESC} tbl_name [col_name | wild]
概览
MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation.
1 MySQL是数据库管理系统
2 关系型
The SQL part of “MySQL” stands for “Structured Query Language”. SQL is the most common standardized language used to access databases.
3 开源的
4 数据库服务器非常快,可靠可扩展,容易使用
5 MySQL Server works in client/server or embedded systems.
6 A large amount of contributed MySQL software is available.
特征
1 Written in C and C++. 测试是用的Purify
2 Uses very fast B-tree disk tables (MyISAM) with index compression
3 Designed to make it relatively easy to add other storage engines. This is useful if you want to provide an SQL interface for an in-house database.
4 Uses a very fast thread-based memory allocation system.
5 Executes very fast joins using an optimized nested-loop join.
6 Implements in-memory hash tables, which are used as temporary tables.
数据类型
Many data types: signed/unsigned integers 1, 2, 3, 4, and 8 bytes long,
FLOAT
,DOUBLE
,CHAR
,VARCHAR
,BINARY
,VARBINARY
,TEXT
,BLOB
,DATE
,TIME
,DATETIME
,TIMESTAMP
,YEAR
,SET
,ENUM
, and OpenGIS spatial types. See Chapter 11, Data Types.Fixed-length and variable-length string types.
语句和函数
1 全部地支持操作符和函数
mysql> SELECT CONCAT(first_name, ' ', last_name)
-> FROM citizen
-> WHERE income/dependents > 10000 AND age > 30;
2 全部支持 Group by和order by
(COUNT()
, AVG()
, STD()
, SUM()
, MAX()
, MIN()
, and GROUP_CONCAT()
).
3 支持 left outer join
right outer join 标准SQL和ODBC语法
4 支持别名
5 支持 delete insert replace update to return the number of rows that were changed (affected), or to return the number of rows matched instead by setting a flag when connecting to the server
6 支持show语句 Support for the INFORMATION_SCHEMA database, implemented according to standard SQL.
7 explain 语句to show how the optimizer resolves a query.
8 表格函数名和行列名相互独立。唯一限制是不能有空格,
9 You can refer to tables from different databases in the same statement.
安全
1 A privilege and password system that is very flexible and secure, and that enables host-based verification.
2 Password security by encryption of all password traffic when you connect to a server.
连接
1 Clients can connect using TCP/IP sockets on any platform.
2 On Unix systems, clients can connect using Unix domain socket files.