In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the concept and function of mysql primary key, hoping to supplement and update some knowledge for you. If you have any other questions you need to know, you can continue to follow my updated article in industry information.
What is the mysql primary key?
Mysql database primary key refers to the combination of one or more columns whose value uniquely identifies each row in the table, through which the physical integrity of the table can be enforced. The primary key is mainly used for the foreign key association of other tables, as well as the modification and deletion of this record.
The role of mysql primary key
1. The main function is to determine the uniqueness of the data. For example, ID=1,NAME= Zhang San. If we want to find this data in the database, we can use select * from table where id=1 so that we can find out Zhang San. And this Zhang San, can also appear the same name, all use ID as the primary key.
2. Insert into is an insert operation. When ID is set to the primary key, and then insert the same primary key value, it will report an error and will not be updated. If you want an update, you must execute UPDATE.
① PRIMAPY means primary key, which means that the defined column value is unique in the table and cannot be repeated.
② AUTO_INCREMENT can be understood as automatically incrementing, and the value is automatically incremented by 1 for each additional record.
Such as:
CREATE TABLE `table name` (`id` smallint (6) unsigned NOT NULL auto_increment, `name` varchar (16) NOT NULL default'', PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 if you insert into tablename (id,name) values ('', 'sadfa')
Related recommendation: "MySQL tutorial"
These are the details of what the mysql primary key is, please pay more attention to other related articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.