Skip to main content

SQL ALTER TABLE

The SQL ALTER TABLE command is used to modify the definition (structure) of a table by modifying the definition of its columns. The ALTER command is used to perform the following functions.
1) Add, drop, modify table columns
2) Add and drop constraints
3) Enable and Disable constraints

Syntax to add a column

ALTER TABLE table_name ADD column_name datatype;
For Example: To add a column "address" to the student table, the query would be like

ALTER TABLE employee ADD address varchar(500);

Syntax to drop a column

ALTER TABLE table_name DROP column_name;
For Example: To drop the column "age" from the student table, the query would be like

ALTER TABLE employee DROP age; 

Syntax to modify a column
ALTER TABLE table_name MODIFY column_name datatype;
For Example: To modify the column fees in the student table, the query would be like

ALTER TABLE employee MODIFY fees number(15,2);

SQL RENAME Command

The SQL RENAME command is used to change the name of the table or a database object.
If you change the object's name any reference to the old name will be affected. You have to manually change the old name to the new name in every reference.

Syntax to rename a table

RENAME old_table_name To new_table_name;
For Example: To change the name of the table student to All_Students, the query would be like

RENAME student TO All_Students;

Comments

Popular posts from this blog

Download SCERTUP BTC 2011 Application Form

Note : Professional Courses Student can also now apply for UP BTC 2011 and date extended. The SCERT of UP was established at Lucknow in 1981 as an apex government organization at the state level. The State Council of Educational  Research  &  Training , U.P., is providing academic support to the District Primary Education Program intended primarily to accelerate the processes of pedagogical renewal in the state.   The Utter Pradesh Education Board Basic Training Certificate or B.T.C Application Form 2011 is now available for download on the Uttar Pradesh State Council of Educational Research & Training (SCERT) official website. Pre-Service Training * Training of Special B.T.C. Trainees. Training Urdu Special B.T.C. in process * Training of Shiksha Mitras, EGS/ AIE Instructors & Literacy functionaries. * Pre-service Training for physical Education and nursery training also being conducted. The thrust areas include  (a) development of curriculum, r

UP TET 2011 Exam Application,UPTET 2011 Result | UPTET 2011 Revised Result

UPTET 2011 Result | UPTET 2011 Revised Result | UPTET 2011 Updated Result |Board of High School and Intermediate Education Uttar Pradesh, Allahabad UP TET Advertisement 2011 and Exam Detail/Admit Card/Call Letter Download UP TET 2011 FORM & DETAILS  GET LATEST DETAIL ABOUT 72825 Primary Teacher Merit List UP TET 2011 Application form submission last date is 18-Oct-2011.Forms will be distributed from PNB bank all over UP.According to latest news Appearing B.Ed student also eligible for TET exam 2011 so they can also submit their forms to concern District.There is no requirement for Rojgar Registration No and Bank receipt within the application form.UP TET 2011 exam results will be avail on http://www.uptet2011.com . Now you can easily get Application from from the P.N.B bank Branches. UPTET 2011 Result | UPTET 2011 Revised Result | UPTET 2011 Updated Result |  Board of High School and Intermediate Education Uttar Pradesh, Allahabad

ASP.Net : The test form is only available for methods with primitive types as parameters

I made a webservice but some methods cannot be tested, I get following message:   The test form is only available for methods with primitive types as parameters.    when click on the service it display this irritating message. I found that this could also be due to passing the variables in the Method definition as ref.  I removed in marked in red circle to solve the problem.