Skip to main content

How To Rename Or Change Name of Table Columns in MySQL

To change column name in MySQL Table,
ALTER TABLE table_name CHANGE old_column_name new_column_name DATA_TYPE;

For example,to change misspelled column name 'fist_name',
ALTER TABLE users CHANGE fist_name first_name VARCHAR(64);

In addition, you can change multiple column names in a query and set languages, default value, etc.
ALTER TABLE users CHANGE fist_name first_name VARCHAR( 64 ) NOT NULL,
  CHANGE username user_name VARCHAR( 32 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ,
  CHANGE gend gender TINYINT( 1 ) NOT NULL DEFAULT 0;

Comments

Popular posts from this blog

Google's Favorite Colors By Hex Codes (With New Google Logo)

Google keeps its color scheme cross their products. Of course, each uses different colors but it keeps the main philosophy. I heard that the test period for new Google logo was more than one year. It may the reason that the colors are comfortable to look. Sometimes, I copy the colors for designing my blogs and web sites. Copyright? oh..

Color Conversion: RGB to HEX , HEX to RGB

Color conversion between RGB and Hex is needed sometimes even though HTML and CSS accepts both RGB and HEX codes for set color scheme of HTML elements. The conversion algorithm is simple. Then numbers in RGB format is decimal number and one in HEX code is hexadecimal number. For example, rgb(50, 100, 250) is same in HEX #3264FA: 50-32 | 100-64 | 250-FA.

Why Blogger Mobile Template Not Work?

Google Blogger shows blog pages with mobile CSS on mobile devices unless you change it disabled. You can see next figure by clicking mobile setting button on Template page. Since I want to change CSS and I remember there are some CSS elements starting with '.mobile', I open the template editor and edit as I want. And open my blog in my smart phone. Nothing changed.