当前位置:网站首页>How MySQL modifies field type and field length

How MySQL modifies field type and field length

2022-06-10 17:15:00 1024 Q

Catalog

mysql Modify field type and field length

1、 Modify field type

2、 Modify field length

Modify the length of a field in the database table

mysql Modify field type and field length 1、 Modify field type

Format :alter table Table name modify column Field name type ;

example :

take users Tabular registerTime Change the field to datetime type ;

alter table users modify column registerTime datetime;2、 Modify field length

Format :alter table Table name modify column Field name type ( length );

example :

take users Tabular username Change the field to varchar type , The length is 30 Bytes ;

alter table users modify column username varchar(30); Modify the length of a field in the database table // Create a temporary table CREATE TABLE TMP_TABLE(CUSNO CHAR(10))// modify TMP_TABLE In the table CUSNO Length of field ALTER TABLE TMP_TABLE MODIFY CUSNO CHAR(20)

The above is personal experience , I hope I can give you a reference , I also hope you can support the software development network .


原网站

版权声明
本文为[1024 Q]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101554537448.html