Mysql must know will read the first chapter (Foundation) _mysql

Source: Internet
Author: User

1.1 What is a database

A database is a collection of data that is stored in an organized manner. A container that holds organized data (usually a file or a set of files)

Note: People usually use databases to represent the database software they use. In fact, this is not true, to be exact, the database software should become a DBMS (database management system). A database is a container that is created and manipulated through a DBMS. A database can be a file that is saved on a hardware device, but it may not. To a large extent, it doesn't matter whether a database is a file or something, because you don't access the database directly; you're using a DBMS that accesses the database for you.

1.2 Table

Tables (table) a structured list of data of a particular type.

Note: The uniqueness indicated depends on a combination of several factors, such as database name and table name. This means that although you cannot use the same table name two times in the same database, query can use the same table name in different databases.
Tables have features that define how data is stored in a table, what data can be stored, how the data is decomposed, and how the information for each part is named. This set of information describing the table is the so-called pattern that can be used to describe a particular table in a database and the entire database (and the relationship between the tables)

1.3 Mode

Schema is information about the layout and characteristics of databases and tables.

Note: is the schema or database, and sometimes the schema is synonymous with the database. Unfortunately, the meaning of the pattern is often not very clear in context.

1.4 Columns

A field in the Columns (column) table. All tables are made up of one or more columns.

Note: Decompose the data. It is extremely important to correctly decompose data into multiple columns. For example, cities, states, and postal codes should always be separate columns. By breaking it down, it is possible to use a specific queue data peer to sort and filter.

1.5 Data types

Type of data that the data type (DataType) allows. Each table column has a corresponding data type that restricts the data stored in that column.

1.6 Lines

A record in the Rows (row) table.

Note: Is it a record or a line? You may hear the user calling it a database record when referring to a row. To a large extent, the two terms can be substituted for each other, but technically, the line is the correct term.

1.7 Primary keys

Primary key (primary key) a column (or set of columns) whose value uniquely distinguishes each row in the table.

Note: Primary keys should always be defined, although primary keys are not always required, but most database designers should ensure that each table they create has a primary key for future data manipulation and management.

Any column of a table can be used as a primary key, as long as it satisfies the following criteria:

* Any two rows do not have the same primary key value.

* Each row must have a primary key value (the primary key value column does not allow null values)

The rule here is that MySQL itself enforces the

A good habit of using primary key values:

1. Do not update the values in the primary key columns.

2. Do not reuse the value of the primary key column;

3. Do not use values that may change in the primary key column. (For example, if you use a name as the primary key to identify a vendor, you must change the primary key when changing the vendor to merge and change its name)

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.