Grokking SQL for Tech Interviews
Ask Author
Back to course home

0% completed

ALTER
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

ALTER

In SQL, the ALTER statement is used to modify the structure of an existing database object, such as a table.

It allows you to add, modify, or drop columns, constraints, or other elements of a table without having to drop and recreate the entire table.

The basic syntax for the ALTER statement varies depending on the specific modification you want to make. Here are some examples.

Adding a column

To add a new column in a database table, you can use the ALTER command like this

ALTER TABLE table_name ADD column_name data_type;

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible