Basic tutorial of T-SQL: Set Theory

Source: Internet
Author: User
The set theory was created by the mathematician GeorgCantor, a mathematical branch based on a relational model. The Cantor set is defined as follows: set, we mean: any collection of M is the whole we perceive or think of, can be identified, the object m (called the elements of M. ── Joseph phw. Dauben and GeorgCantor (published by Princeton University)

The set theory was created by the mathematician Georg Cantor, a mathematical branch based on Relational Models. The Cantor set is defined as follows: set, we mean: any collection of M is the whole we perceive or think of, can be identified, the object m (called the elements of M. ── Joseph W. Dauben and Georg Cantor (published by Princeton University)

The set theory was created by the mathematician Georg Cantor, a mathematical branch based on Relational Models. The Cantor set is defined as follows:

Set, we mean: any collection of M is the whole we perceive or think of, can be identified, the object m (called the elements of M.

── Joseph W. Dauben and Georg Cantor (Princeton University Press, 1990)

Each word in the definition has profound and important significance. There is no need to prove the principle of set definition and set subordination. Each element in the universe is either a set member or a set member.

Let's start with each word in the Cantor definition. A "set" should regard it as a single entity, and your focus should be on the collection of objects rather than a single object that forms a set. Then, when you write T-SQL queries to tables in the database (such as employee tables), you should think of the set of employees as a whole, rather than a single employee. This may not be important and very simple, but it is obvious that many programmers are difficult to adopt this way of thinking.

The meaning of the word "interconnectivity" means that each element in the set must be unique. To jump to a table in the database, you can define the key constraint to force the uniqueness of the row in the tabulation. Without a key, you cannot uniquely identify the row, so the table cannot be qualified as a "set. Instead, the table is a multi-set or unordered unit group.

The sentence "we perceive or think of" means that the definition of the set is subjective. Think about the classroom: A person can be considered a collection of "people" or a collection of "Students" or "Teachers. Therefore, you have a great degree of freedom in defining a set. When you design a data model for a database, the design process should carefully consider the subjective needs of the application to determine the appropriate definitions for the relevant entities.

As for "objects", the definition of a set is not limited to physical objects such as cars or employees, but related abstract objects such as prime numbers or lines.

The content omitted by the Cantor set definition is likely to be as important as the content contained. Note that the order between the elements of a set is not mentioned in the definition. The order in which the elements of a set are listed is not important. To list the formal markup symbols of a set element, use braces: {a, B, and c }. Because it is irrelevant to the sequence, you can use {B, a, c} or {B, c, a} to represent the same set. Jump to the attribute (column in SQL) set, which forms the header of the Link (table in SQL). The element should be identified by name, rather than by sequential position.

Similarly, think about the settings of tuples (called rows in SQL), which constitute the subject of the link. elements are identified by their key values, rather than by location. It is difficult for many programmers to adapt to this concept. There is no sequence between rows for querying tables. In other words, a table query can return rows in any order, unless you explicitly require data to be sorted in a specific manner based on specific presentation purposes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.