Difference between mysql and oracle _ MySQL

Source: Internet
Author: User
Difference between mysql and oracle bitsCN.com

Differences between mysql and oracle

1. differences between mysql and oracle databases for auto-increment columns:

Mysql can implement auto-increment columns. you only need to set auto_increment when creating a table, but oracle cannot set auto-increment columns when creating a table,

You must use the sequence to implement the auto-incrementing column function. the Statement for creating the sequence is as follows (assuming the sequence is named ts_sequence ):

Create sequence ts_sequenceINCREMENT BY 1 -- add a few start with 1 each time -- count NOMAXVALUE from 1 -- do not set the maximum value NOCYCLE -- always accumulate, do not loop CACHE 10;

After sequence is defined, you can use ts_sequence.nextval and ts_sequence.currval in the insert statement,

Ts_sequence.currval returns the current sequence value, but it must be used after the first ts_sequence.nextval initialization.

Ts_sequence.currval.

2. differences between mysql and oracle database indexes:

In the entire database, mysql indexes can have the same name, that is, mysql indexes are table-level, but Oracle indexes cannot have the same name, that is, Oracle indexes are Database-level;

Mysql indexes start from 0 and oracle indexes start from 1.

Create index indexName on tableName (columnName); delete index mysql: alter table tableName drop index indexName oracle: drop index indexName query table index mysql: show index from tableName Oracle: select index_name, table_name, column_name from user_ind_columns where table_name = 'tablename'


BitsCN.com

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.