当前位置:网站首页>MySQL uses SQL statements to modify field length and field name

MySQL uses SQL statements to modify field length and field name

2022-06-22 10:47:00 Not enough seedlings

mysql Use sql Statement to modify the length or name of a field

  1. Modify the length of the field :
ALTER TABLE  Table name  MODIFY COLUMN  Field name   data type ( Modified length )

for example :
Change the length of the name field of the student table from 5 Modify to 10

ALTER TABLE student MODIFY COLUMN name VARCHAR(10)
  1. Change the name of the field :
ALTER TABLE  Table name  CHANGE  Field name   New field name   data type ( Data length )

for example :
Put the... Of the student table name It is amended as follows student_name

ALTER TABLE student CHANGE name student_name VARCHAR(10)
原网站

版权声明
本文为[Not enough seedlings]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221034047294.html