C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

Home » SQL

SQL Query to alter column size

In this article, we are going to learn about the property of column and then we will alter the pre-defined size of column.
Submitted by Manu Jemini, on March 14, 2018

The Columns can have multiple properties. These properties define just about everything the value of that column can have. Now, the data type of a column can be of a type which has upper limit to it. For example, type varchar has an upper limit, which tells us that how many characters the field can have.

Now the problem arises when we have set the upper limit and wants to change it. To solve it, use the ALTER keyword and tells it which column or field you want to change. This same like changing the name or type of the column.

You should always define the properties clearly during the creation of table because once the database increases, it will be difficult to keep track of everything.

Table (employee) having three fields and four data in it,

    Id		Name		Address

    100		Aman		Mumbai
    200		Arun		Pune
    300		Karan		Delhi
    400		Aman		Mumbai

As always we have our employee table with three column and four data rows in it and now we need to modify one of our column’s pre-defined size, suppose the column we need to alter names and then we can just take the column name and create a alter table query with modify column and give it a new size.


ALTER TABLE employee 


SQL Query to alter column size

Liked this article? Do share with your friends :)

Are you a blogger? Join our Blogging forum.