---
title: "How to Alter Table: Top SQL Queries"
description: "Explore various SQL Alter Table queries to modify and update database table structures. Learn how to add, modify, and drop columns, change data types, and manage constraint"
url: https://srinimf.com/2018/10/25/sql-alter-statement-top-examples-useful-to-write-any-complex-query/
date: 2018-10-25
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2018/10/pexels-photo-9034987.jpeg?fit=1880%2C1253&ssl=1
categories: ["SQL"]
tags: ["SQL Alter Table Queries"]
type: post
lang: en
---

# How to Alter Table: Top SQL Queries

Here are the SQL queries helpful [to alter](https://srinimf.com/2016/01/30/how-to-change-table-column-data-type-in-db2/) a table. The things you can do are add columns, add indexes, add keys, add buffer pools, and modify function parameters.

Related[SQL Views: Tricky Interview Question Asked in Many Companies](https://srinimf.com/2020/05/17/sql-views-present-after-modifying-table/)

Advertisements

## SQL ALTER statement: These You Can do

Here are database objects you can ALTER. The list is TABLE, INDEX, FUNCTION, MASK, TABLESPACE, SERVER, SEQUENCE, and THRESHOLD.

### #1 Add a Column

Here you can add a new [column](https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.dbobj.doc/doc/t0005233.html) for an existing Table. Also, you can modify the existing column data type.

```
ALTER TABLE table_name ADD COLUMN name_of_column;
```

### #2 Add an Index

You cannot add a new Index to an existing Table. When you want to add a new index, [you need to](https://srinimf.com/2022/03/19/everything-you-need-to-know-about-alter-index-in-db2/) drop existing ones and create new ones.

The REGENERATE specifies that the index will be regenerated or rebuilt. This command is useful if an index is already created.

```
ALTER INDEX index_name REGENERATE;
```

### #3 ADD Buffer pools

You can modify database parameters. For instance, you can add more buffer pools. Also, you can add storage or drop storage.

```
ALTER DATABASE database_name new_buffer_pool;
```

### #4 ALTER Criteria of a Function

You can modify the parameters (criteria) of a user-defined function.

```
ALTER FUNCTION GET_TABLE
    RESTRICT CARDINALITY 10000;
```

**S**ummary

Usually, in production, the ALTER statement Admin will use it. But in the test regions, a developer can use ALTER statement.

**References**

- [More topics on SQL ALTER uses](https://www.ibm.com/support/knowledgecenter/en/SSEPGG_9.7.0/com.ibm.db2.luw.sql.ref.doc/doc/r0000888.html)

**Related Posts**

- [How to Find Databricks Job Status, Owner, and Active Runs Fast](https://srinimf.com/2026/10/17/databricks-find-job-status/)
- [30 SQL Practice Queries with Solutions — Run Them Live](https://srinimf.com/2026/10/01/30-sql-practice-queries-with-solutions-run-them-live/)
- [Supercharge Your Database Skills: Try Our New Interactive SQL Plugin!](https://srinimf.com/2026/09/30/supercharge-your-database-skills-try-our-new-interactive-sql-plugin/)

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2018%2F10%2F25%2Fsql-alter-statement-top-examples-useful-to-write-any-complex-query%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2018%2F10%2Fpexels-photo-9034987.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=How%20to%20Alter%20Table%3A%20Top%20SQL%20Queries)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2018/10/25/sql-alter-statement-top-examples-useful-to-write-any-complex-query/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2018/10/25/sql-alter-statement-top-examples-useful-to-write-any-complex-query/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2018/10/25/sql-alter-statement-top-examples-useful-to-write-any-complex-query/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2018/10/25/sql-alter-statement-top-examples-useful-to-write-any-complex-query/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20How%20to%20Alter%20Table%3A%20Top%20SQL%20Queries&body=https%3A%2F%2Fsrinimf.com%2F2018%2F10%2F25%2Fsql-alter-statement-top-examples-useful-to-write-any-complex-query%2F&share=email)
-

### Like this:

Like Loading…
