Wonderland
Search…
README.md
Notebook
Crypto
Language
Textbook
Serials
Frontend
dictionary
Alphabet
MySQL
FFmpeg
Algorithm
Troubleshooting
Powered By
GitBook
MySQL
Usage
Alter table
Add a column to a table
We can add a column to a table with a specified order with the keyword
FIRST
to the front of all columns or
AFTER `exist_column_name`
to after the column
`exist_column_name`
.
1
ALTER
TABLE
`
table_name
`
ADD
COLUMN
`
new_column_name
`
VARCHAR
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'some_comments'
AFTER
`
exist_column_name
`
;
Copied!
Change the data type of a column
1
ALTER
TABLE
`
table_name
`
MODIFY
COLUMN
`
exist_column_name
`
VARCHAR
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'some_comments'
;
Copied!
dictionary - Previous
Alphabet
Next
FFmpeg
Last modified
24d ago
Copy link
Contents
Usage
Alter table