mysql ALTER TABLE statement


  Translation results:

alter

UK[ˈɔ:ltə(r)] US[ˈɔltɚ]

vt. Change; change; remodel (house); (person) change Old

vi.Change; modify

Third person singular: alters present participle: altering past tense: altered past participle: altered

table

英[ˈteɪbl] 美[ˈtebəl]

n.Table; table, directory; operating table, workbench, game table; flat floor

vt.Tabulation; shelving; Chimera; put aside

adj.

of table Third person singular: tables Plural: tables Present participle: tabling Past tense: tabled

mysql ALTER TABLE statementsyntax

Function:Used to add, modify or delete columns in an existing table.

Syntax: Add column: ALTER TABLE table_name ADD column_name datatype. Drop a column: ALTER TABLE table_name DROP COLUMN column_name. Modify columns: ALTER TABLE table_name ALTER COLUMN column_name datatype.

Note: Some database systems do not allow this method of deleting a column in a database table (DROP COLUMN column_name).

mysql ALTER TABLE statementexample

//在表 "Persons" 中添加一个名为 "Birthday" 的新列
ALTER TABLE Persons ADD Birthday date;
//改变 "Persons" 表中 "Birthday" 列的数据类型
ALTER TABLE Persons ALTER COLUMN Birthday year;
//删除 "Person" 表中的 "Birthday" 列
ALTER TABLE Person DROP COLUMN Birthday;

Popular Recommendations

Home

Videos

Q&A