ALTER TABLE
BrandonDusch580 total contributions
Published May 7, 2021Updated Jun 25, 2022
Contribute to Docs
The ALTER TABLE
command adds, deletes, modifies, or changes the data type of a column in a table.
Code Example
Beginning table:
student_id | name | address | last_terms_grades | overall_gpa |
---|---|---|---|---|
10001 | Tim | 123 R Ave | 2.4 | 3.1 |
10002 | Amy | 789 T St | 3.2 | 3.8 |
ALTER TABLE studentsADD exam_grade INT(3);
After ADD
ing the new column exam_grade
:
student_id | name | address | last_terms_grades | overall_gpa | exam_grade |
---|---|---|---|---|---|
10001 | Tim | 123 R Ave | 2.4 | 3.1 | null |
10002 | Amy | 789 T St | 3.2 | 3.8 | null |
ALTER TABLE studentsDROP COLUMN last_terms_grades;
After DROP
ing the column last_terms_grades
:
student_id | name | address | overall_gpa | exam_grade |
---|---|---|---|---|
10001 | Tim | 123 R Ave | 3.1 | null |
10002 | Amy | 789 T St | 3.8 | null |
All contributors
- BrandonDusch580 total contributions
- christian.dinh2476 total contributions
- Anonymous contributorAnonymous contributor3071 total contributions
- BrandonDusch
- christian.dinh
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.