mysql中SERIAL和AUTO_INCREMENT有什么区别 [英] What is the difference between SERIAL and AUTO_INCREMENT in mysql
本文介绍了mysql中SERIAL和AUTO_INCREMENT有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了两种自动增加mysql中id的方法.
I have come across two ways to increment the ids in mysql automatically.
一个是 SERIAL ,另一个是 AUTOINCREMENT .
因此,假设我想创建一个表myfriends. 我可以通过两种方式创建它:
So Suppose i want to create a table myfriends. I can create it in two ways like:
1)
mysql> create table myfriends(id int primary key auto_increment,frnd_name varchar(50) not null);
2)
mysql> create table myfriends(id serial primary key,frnd_name varchar(50) not null);
两者之间有什么区别?
OR
有谁能比其他人有优势?
Do anyone way has advantages over other ?
请帮助.
推荐答案
查看全文