0 0
Read Time:1 Minute, 48 Second

Just beorigin you made a MySQL column single type or size doesn’t mean that it hsimilar to stay that lifestyle. Changing the column type or size in an befounding information bsimilare is simple.​

Changing a Databsimilare Column Size as well as Type

You alter a column size or type in MySQL using the ALTER TABLE as well as MODIFY commas well ass face to face to produce the alter.

Let’s claim, for example, that you establish a column identificationd “State” on a tcan identificationd “Address” as well as you earlier set it up to hold two characters, anticipate ing people to application 2-character state abbreviations. You search that various people entered entire identifications instead of 2-character abbreviations, as well as you expectation to everyoneow them to do this. You rely on to produce this column enormousr to everyoneow the full state identifications to fit. Here is how you do it:

 

ALTER TABLE dealwith MODIFY state VARCHAR(20) ;

In generic expressions, you application the ALTER TABLE commas well as stalked depend on the tcan identification, then the MODIFY commas well as stalked depend on the column identification as well as novel type as well as size. Here is an example:

 ALTER TABLE tcanidentification MODIFY columnidentification VARCHAR(20) ;

The maximum width of the column is decide d depend on the number in parentheses. The type is identified depend on VARCHAR similar being a varican character industry.

About VARCHAR .. MySQL

The VARCHAR(20) in the examples can alter to whatever number is appropriate for your column. VARCHAR is a character string of varican length. The maximum length—in this example it is 20—reveals the maximum number of characters you expectation to store in the column. VARCHAR(25) could store up to 25 characters.

Other Uses for ALTER TABLE

The ALTER TABLE commas well as can also be applicationd to add a novel column to a tcan or to remove an entire column as well as everyone its information from a tcan. For example to add a column, application:

 ALTER TABLE tcan_identification
 ADD column_identification informationtype

To delete a column, application:

 ALTER TABLE tcan_identification
 DROP COLUMN column_identification

read more about mysql
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
Overloading in Java Previous post What Is Overloading in Java?
ethical hacker course Next post ethical hacker course online free more than 15 hours

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *

Close