Skip to content

ALTER

CREATE TABLE employees (
ID INT PRIMARY KEY,
Name VARCHAR(30),
Age INT
);
ALTER TABLE employees
ADD COLUMN Position VARCHAR(30);
SELECT * FROM employees;

#End of Example Code

+----+------+-----+----------+
| ID | Name | Age | Position |
+----+------+-----+----------+

#End of Output

In the example provided, a new table called ‘employees’ is created with three columns: ‘ID’, ‘Name’ and ‘Age’. The ALTER TABLE statement is then used to add a new column ‘Position’ to the ‘employees’ table. The SELECT statement is used to view the contents of the updated ‘employees’ table.