How to Modify Column From MySQL Existing Table Example
Open your MySQL Query Editor then copy & paste the below code to make a table "users"
Then copy & paste the below code to Modify a column from a MySQL Existing table "users"
----------- making a table users ---- ---- CREATE TABLE users( id INT UNSIGNED AUTO_INCREMENT NOT NULL, username VARCHAR(255) NOT NULL, password CHAR(40) NOT NULL, PRIMARY KEY(`id`) ); -- MySQL Modify Column From Existing Table -- -- Lets have a look an existing table "users" -- desc users; -- -- Now Modify column "active" from the table "users" -- ALTER TABLE users Modify COLUMN active INT NOT NULL default 1; -- -- -- Finally Lets have a look into the table "users" again to get the desired result -- desc users; --
-- is comment in MySQL
-- in fact it is comment in MSSQL and Oracle as well
How to Modify Column From MySQL Existing Table Example - Result in MySQL Query Editor
Related Tutorial Examples
- MySQL sample database script: Create Database using SQL Statement Example
- How to Drop Column From MySQL Existing Table Example
- SELECT distinct... SQL Command MySQL Example
- SELECT specific row(s) of a Table using SQL Command MySQL Example
- SELECT all rows of a Table using SQL Command MySQL Example
- Inserting data into Table(s) using SQL Command MySQL Example
- Creating a Table(s) with datatype using SQL Command MySQL Example
- MySQL concat operator SQL Example
- MySQL NULL to empty string Example
- MySQL Stored Procedure: Creating Table using Stored Procedure Example
- 20 steps to make CakePHP Blog Project

No comments:
Post a Comment
leave your comments here..