Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Master some knowledge of mysql storage engine and data types

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces you to master some knowledge of mysql storage engine and data types, the contents of the article are carefully selected and edited by the author, with a certain pertinence, the reference significance for everyone is still relatively great, the following with the author to learn to master some knowledge of mysql storage engine and data types.

Storage engine

The database storage engine (which affects the way data is stored and transactions) stores and manipulates the types of tables

There is only one storage engine in oracle and sql. Mysql has a variety of storage engines. Users can write their own storage engines according to their own needs.

View Storage Engin

Show engines\ g

Show variables like 'have%'

Show variables like 'storage_engine%'

The default is innodb, which supports transactions, row-level locks, etc.

Select Storage engine

Select when creating the table

Create table innodb1 (

Id int

) engine=innodb

Another vi / etc/my.cnf

Default-storage-engine=innodb

Myisam (does not support transactions, an old storage engine, nor does it support foreign keys) the default storage engine before 5.5

Innodb (most commonly used) default storage engine after 5.5,

Memory (the fastest access, insecure, suitable for fast access or temporary tables, placed in memory)

Database data type

In the mysql database management system, the type of table can be determined by the storage engine, and mysql also provides the data type to determine the type of data stored in the table.

Data type:

Integer type int smallint bigint tinyint stores the user's age, game level, etc., followed by the width of parentheses has no constraint.

Floating point type float double stores users' weight, height, salary, etc., followed by the width of parentheses.

Fixed-point type DEC is more accurate than floating-point numbers because the range it stores as string values refers to

Bit type BIT

Character type char varchar stores the user's name, home address, hobbies, published articles, etc.

Text type text

The date type date,datetime,year stores the user's registration time, post release time, login time, entry time, etc.

Enumerated type enum radio such as gender

Multiple set collection types, such as hobbies

To optimize storage, the most precise type should be used in all cases to minimize the amount of storage disk memory

After reading the above about mastering some knowledge of mysql storage engine and data types, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report