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

Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.