Databases| SQL| MySQL| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Mysql Alter Column Default 
 

Mysql Alter Column Default is used to modify the table and add a default column to Null.

 

Mysql Alter Column Default

                         

Mysql Alter Column Default is used to modify the table and add a default column to Null.

Understand with Example

The Tutorial illustrate an example from 'Mysql Alter Column Default'. To understand and grasp this example we create a table 'userform' with required fieldnames and datatypes respectively.The table 'userform' has a primary key ID column.

Create table "userform":

CREATE TABLE `userform` ( 
`ID` int(11) NOT NULL auto_increment, 
`username` varchar(100) default NULL, 
`fname` varchar(100) default NULL, 
`email` varchar(100) default NULL, 
`count` bigint(20) default NULL, 
PRIMARY KEY (`ID`) 

 

+----+----------+---------+----------------------+-------+
| ID | username | fname | email | count |
+----+----------+---------+----------------------+-------+
| 1 | vineet | vineet | vineet@roseindia.net | 0 |
| 2 | sourabh | Sourabh | srbh@roseindia.net | 0 |
+----+----------+---------+----------------------+-------+

Alter the table 'userform' and add column to set default:

The Query Alter is used to modify table 'usertable' and add the column default value to Null.

ALTER table usertable Modify last_name varchar(50) null;

Describe userform:

The Describe table is used to show the table  fieldname, Type, Null, Key, Default etc.

Describe usertable;

Output

+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| username | varchar(50) | NO | | | |
| first_name | varchar(200) | NO | | | |
| last_name | varchar(50) | YES | | | |
+------------+--------------+------+-----+---------+-------+

                         

» View all related tutorials
Related Tags: sql mysql c table io multiple sed column ip definition name columns rename tab if to ini modify e it

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.