Databases| SQL| MySQL| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Mysql Alter Command 
 

Mysql Alter Command define the list of Command used for removing 'Primary key','Unique index','Delete Column','Change column' etc.

 

Mysql Alter Command

                         

Mysql Alter Command define the list of Command used for removing 'Primary key','Unique index','Delete Column','Change column' etc.

Understand with Example

The Tutorial illustrate an example from 'Mysql Alter Command'. To understand this example  we use Alter keyword that redefine the table 'tablename' and Drop primary key is used  to remove/delete the primary key in a table.  

SYNTAX:

 

 

 

For removing primary key:-

ALTER TABLE tablename DROP PRIMARY KEY;

For removing a Unique index:

The Alter table is used to modify the table 'table name' and remove the index 'index_name' from the existing 'tablename'. 

ALTER TABLE tablename DROP INDEX index_name;

Adding a primary key :

The Alter Table is used to modify table 'tablename' and add a primary key to the column 'index_column'.

ALTER TABLE tablename ADD PRIMARY KEY (index_columns);

Delete a column:

The given below Syntax uses 'Alter' table is used to redefine the table 'tablename' and drop query is used to delete the column name.

ALTER TABLE table name drop column column name;

Add a new column to db:

The below Query is used to modify the table 'tablename' and add a column 'columnname'.

ALTER TABLE tablename ADD Column columnname type;

Change column name:

The below Alter Table is used to modify the tablename and change the column name. 

ALTER TABLE tablename change oldcolumnname newcolumnname type;

Make a unique column:

The given below Query 'Alter Table' is used to modify the table  and add a unique column name.

ALTER TABLE tablename add unique columnname;

Delete unique from table:

The given below Query is used to modify the table and delete the column name from index.

ALTER TABLE tablename drop index columnname;

Alter a column size:

The Alter Table is used to modify the table and alter the size of column.

ALTER TABLE table name modify column name type;

Renaming a Table:

The Alter Table is used to modify the table and change the table name.

ALTER TABLE table name RENAME  To tablename;

                         

» 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.