当前位置:Gxlcms > 
数据库问题 > 
mysql5.5基础 create table... 创建不可空、主键、自增长的字段
                     
                    
                        mysql5.5基础 create table... 创建不可空、主键、自增长的字段
                        
                            时间:2021-07-01 10:21:17
                            帮助过:4人阅读
							                        
                     
                    
                    
                     create table student(
    -> stdId 
int not null auto_increment 
primary key
    -> );
Query OK, 0 rows affected (
0.08 sec)
mysql> desc student;
+-------+---------+------+-----+---------+----------------+
| Field 
| Type    
| Null | Key | Default | Extra          
|
+-------+---------+------+-----+---------+----------------+
| stdId 
| int(
11) 
| NO   
| PRI 
| NULL    | auto_increment 
|
+-------+---------+------+-----+---------+----------------+
1 row 
in set (
0.01 sec)
mysql>
 
小贴士
  主键与不为空重叠了,也就是说 这个字段是主键,那么就不用写 不为空了。
 
  
mysql,关系型数据库管理系统,优秀,值得学习。
学习资源:itcast和itheima视频库 + 清净的心地。
如果您有公开的资源,可以分享给我的话,用您的资源学习也可以。
博文是观看视频后,融入思考写成的。博文好,是老师讲得好。博文坏,是 给最苦 没认真。
mysql5.5基础 create table... 创建不可空、主键、自增长的字段
标签:class   set   数据库   pre   分享   post   系统   管理系统   weight