zt:Cardinality (SQL statements) 最好的解释

简介: http://www.itpub.net/thread-934862-1-1.htmlIn SQL, the term cardinality refers to the uniqueness of data values contained in a particular column (attribute) of a database table.

http://www.itpub.net/thread-934862-1-1.html

In SQL, the term cardinality refers to the uniqueness of data values contained in a particular column (attribute) of a database table.
When dealing with columnar value sets, there are 3 types of cardinality: high-cardinality, normal-cardinality, and low-cardinality.
High-Cardinality
High-cardinality refers to data table column values that are very uncommon. High-cardinality column values are typically identification numbers, email addresses, or user names. An example of a data table column with high-cardinality would be a USERS table with a column named USER_ID. This column would contain unique values of 1-n. Each time a new user is created in the USERS table, a new number would be created in the USER_ID column to identify them uniquely. Since the values held in the USER_ID column are unique, this column's cardinality type would be referred to as high-cardinality.
Normal-Cardinality
Normal-cardinality refers to data table column values that are somewhat uncommon. Normal-cardinality column values are typically names, street addresses, or vehicle types. An example of a data table column with normal-cardinality would be a CUSTOMER table with a column named LAST_NAME. This column would contain the last names of customers. While some people have common last names, such as Smith, others have uncommon last names. Therefore, an examination of all of the values held in the LAST_NAME column would show "clumps" of names in some places (e.g.: a lot of Smith's ) surrounded on both sides by a long series of unique values. Since there is a variety of possible values held in this column, its cardinality type would be referred to as normal-cardinality.
Low-Cardinality
Low-cardinality refers to data table column values that are not very unusual. Low-cardinality column values are typically status flags, boolean values, or major classifications such as gender. An example of a data table column with low-cardinality would be a CUSTOMER table with a column named NEW_CUSTOMER. This column would contain only 2 distinct values: Y or N, denoting whether the customer was new or not. Since there are only 2 possible values held in this column, its cardinality type would be referred to as low-cardinality.
Retrieved from "http://en.wikipedia.org/wiki/Cardinality_%28SQL_statements%29"

[@more@]
目录
相关文章
|
6月前
|
SQL 关系型数据库 MySQL
实时计算 Flink版操作报错合集之报错显示“Unsupported SQL query! sqlUpdate() only accepts SQL statements of type INSERT and DELETE"是什么意思
在使用实时计算Flink版过程中,可能会遇到各种错误,了解这些错误的原因及解决方法对于高效排错至关重要。针对具体问题,查看Flink的日志是关键,它们通常会提供更详细的错误信息和堆栈跟踪,有助于定位问题。此外,Flink社区文档和官方论坛也是寻求帮助的好去处。以下是一些常见的操作报错及其可能的原因与解决策略。
229 0
|
6月前
|
SQL
Auditing SQL Statements, Privileges, and Other General Activities
Auditing SQL Statements, Privileges, and Other General Activities
34 0
|
6月前
|
SQL 消息中间件 监控
流计算中的流式SQL是什么?请解释其作用和用途。
流计算中的流式SQL是什么?请解释其作用和用途。
106 0
|
6月前
|
SQL BI 数据处理
Flink中的流式SQL是什么?请解释其作用和用途。
Flink中的流式SQL是什么?请解释其作用和用途。
111 0
|
6月前
|
SQL 数据库
SQL LIKE 运算符:用法、示例和通配符解释
SQL中的LIKE运算符用于在WHERE子句中搜索列中的指定模式。通常与LIKE运算符一起使用的有两个通配符: 百分号 % 代表零个、一个或多个字符。 下划线 _ 代表一个单个字符。 以下是LIKE运算符的用法和示例:
249 0
从源码层面解释:为什么执行MyBatis接口就可以执行SQL?
1:场景分析 在我们使用SpringBoot+MyBatis的时候,我们一般是先引入依赖,然后配置
|
SQL 关系型数据库 MySQL
vMySQL的explain解释SQL执行计划,优化SQL执行和创建索引
这里举例说明如何查看MySQL的SQL执行计划,并根据执行计划创建索引。
147 0
|
SQL 存储 关系型数据库
软件测试mysql面试题:解释SQL数据类型?
软件测试mysql面试题:解释SQL数据类型?
90 0
|
SQL 存储 关系型数据库