[Excerpt-database-learning] the so-called increase/decrement script when the service is upgraded __ database

Source: Internet
Author: User

Our online program upgrades always hear what incremental script, I have no idea what happened, this certification looked at the next book, finally know it;


The so-called increment script, that is, when the upgrade of a table added an element, that is, a column of data, or a table, and so on, anyway is to increase things;


table, the following SQL statement is included:


Suppose you need to add a name column to the user table:

MySQL database:

ALTER TABLE user ADD COLUMN name VARCHAR (100);

Oracle Database:

ALTER TABLE user ADD (name VARCHAR2 (100));


If you need to add more columns, such as add name, sex, old three columns in the user table:

MySQL database:

ALTER TABLE user ADD COLUMN (name VARCHAR, sex int, old INTEGER);

Oracle Database:

ALTER TABLE user ADD (name VARCHAR, sex integer, old integer);


To delete a column from a table:

Mysql/oracle Database:

ALTER TABLE user drop name;


MySQL data I personally tested found that multiple columns could not be deleted; Delete multiple columns not tested in Oracle


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.