Mysql£¬SqlServer£¬OracleÖ÷¼ü×Ô¶¯Ôö³¤µÄÉèÖÃ
Mysql£¬SqlServer£¬OracleÖ÷¼ü×Ô¶¯Ôö³¤µÄÉèÖÃ
1¡¢°ÑÖ÷¼ü¶¨ÒåΪ×Ô¶¯Ôö³¤±êʶ·ûÀàÐÍ
ÔÚmysqlÖУ¬Èç¹û°Ñ±íµÄÖ÷¼üÉèΪauto_incrementÀàÐÍ£¬Êý¾Ý¿â¾Í»á×Ô¶¯ÎªÖ÷¼ü¸³Öµ¡£ÀýÈ磺
create table customers(id int auto_increment primary key not null, name varchar(15));
insert into customers(name) values("name1"),("name2");
select id from customers;
ÒÔÉÏsqlÓï¾äÏÈ´´½¨ÁËcustomers±í£¬È»ºó²åÈëÁ½Ìõ¼Ç¼£¬ÔÚ²åÈëʱ½ö½öÉ趨ÁËname×ֶεÄÖµ¡£×îºó²éѯ±íÖÐid×ֶΣ¬²éѯ½á¹ûΪ£º
id
1
2
Óɴ˿ɼû£¬Ò»µ©°ÑidÉèΪauto_incrementÀàÐÍ£¬mysqlÊý¾Ý¿â»á×Ô¶¯°´µÝÔöµÄ·½Ê½ÎªÖ÷¼ü¸³Öµ¡£
ÔÚMS SQLServerÖУ¬Èç¹û°Ñ±íµÄÖ÷¼üÉèΪidentityÀàÐÍ£¬Êý¾Ý¿â¾Í»á×Ô¶¯ÎªÖ÷¼ü¸³Öµ¡£ÀýÈ磺
create table customers(id int identity(1,1) primary key not null, name varchar(15));
insert into customers(name) values("name1"),("name2");
select id from customers;
²éѯ½á¹ûºÍmysqlµÄÒ»Ñù¡£Óɴ˿ɼû£¬Ò»µ©°ÑidÉèΪidentityÀàÐÍ£¬MS SQLServerÊý¾Ý¿â»á×Ô¶¯°´µÝÔöµÄ·½Ê½ÎªÖ÷¼ü¸³Öµ¡£identity°üº¬Á½¸ö²ÎÊý£¬µÚÒ»¸ö²ÎÊý±íʾÆðʼֵ£¬µÚ¶þ¸ö²ÎÊý±íʾÔöÁ¿¡£
2¡¢´ÓÐòÁÐÖлñÈ¡×Ô¶¯Ôö³¤µÄ±êʶ·û
ÔÚOracleÖУ¬¿ÉÒÔΪÿÕűíµÄÖ÷¼ü´´½¨Ò»¸öµ¥¶ÀµÄÐòÁУ¬È»ºó´ÓÕâ¸öÐòÁÐÖлñÈ¡×Ô¶¯Ôö¼ÓµÄ±êʶ·û£¬°ÑËü¸³Öµ¸øÖ÷¼ü¡£ÀýÈçÒ»ÏÂÓï¾ä´´½¨ÁËÒ»¸öÃûΪcustomer_id_seqµÄÐòÁУ¬Õâ¸öÐòÁÐµÄÆðʼֵΪ1£¬ÔöÁ¿Îª2¡£
create sequence customer_id_seq increment by 2 start with 1
Ò»µ©¶¨ÒåÁËcustomer_id_seqÐòÁУ¬¾Í¿ÉÒÔ·ÃÎÊÐòÁеÄcurvalºÍnextvalÊôÐÔ¡£
curval£º·µ»ØÐòÁеĵ±Ç°Öµ
nextval£ºÏÈÔö¼ÓÐòÁеÄÖµ£¬È»ºó·µ»ØÐòÁÐÖµ
ÒÔÏÂsqlÓï¾äÏÈ´´½¨ÁËcustomers±í£¬È»ºó²åÈëÁ½Ìõ¼Ç¼£¬ÔÚ²åÈëʱÉ趨ÁËidºÍname×ֶεÄÖµ£¬ÆäÖÐid×ֶεÄÖµÀ´×ÔÓÚcustomer_id_seqÐòÁС£×îºó²éѯcustomers±íÖеÄid×ֶΡ£
create table customers(id int primary key not null, name varchar(15));
insert into customers values(customer_id_seq.curval, "name1"),(customer_id_seq.nextval, "name2");
select id from customers;
Èç¹ûÔÚoracleÖÐÖ´ÐÐÒÔÉÏÓï¾ä£¬²éѯ½á¹ûΪ£º
id
1
3
http://blog.csdn.net/andyelvis/archive/2008/05/14/2446865.aspx
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
1¡¢¸ü¸Ä±íÃû/ÁÐÃû
Ê×ÏÈ£¬ÒªÒÔsysdbaÉí·ÝµÇ¼£¬²ÅÄܶԱíÃû/ÁÐÃû½øÐиü¸Ä£º
(1)µÇ½sqlplus£¬¿ÉÒÔÒÔnolog·½Ê½µÇ½£¬¹ØÓÚÕâÖֵǽ·½·¨£¬¿ÉÔÚsqlplusµÄͼ±êÉÏÓÒ¼ü£¬µã»÷ÊôÐÔ£¬ÔÚ"Ä¿±ê"À¸¸ÄΪ£º"D:\oracle\product\10.2.0\client_1\BIN\sqlplusw.exe /nolog"£¬È»ºóÔÙË«»÷sqlplusͼ±ê¾Í¿É½øÈë¡£
ÓÐʱoracle²¢²»ÔÚ±¾µØµçÄÔÉÏ£¬µ ......
ÎÒÔÚoracle 9iµÄ»·¾³Ï¿ª·¢ÁËocciµÄÓ¦Ó㬽á¹û·Åµ½10g(10.2.0.3)·þÎñÆ÷ÉÏÔËÐв»ÁË(Ö»×°ÁËwindows °æµÄ10g·þÎñ¶Ë)£¬Ö»ºÃ°ÑËùÓÐÒÀÀµµÄ9iµÄdll¿½¹ýÈ¥£¬½á¹ûÁ¬½Óocci±¨´í£º
Error while trying to retrieve text for error ORA-32101
µ½http://www.oracle.com/technology/global/cn/software/tech/oci/instantclient/index.ht ......
µÇ¼oracleÊý¾Ý¿âʱ³£ÓõIJÙ×÷ÃüÁîÕûÀí
1¡¢su – oracle ²»ÊDZØÐ裬ÊʺÏÓÚûÓÐDBAÃÜÂëʱʹÓ㬿ÉÒÔ²»ÓÃÃÜÂëÀ´½øÈësqlplus½çÃæ¡£
2¡¢sqlplus /nolog »òsqlplus system/manager »ò./sqlplus system/manager@ora9i
;
3¡¢SQL>connect / as sysdba ;£¨as sysoper£©»ò
connect internal/oracle AS SYSDBA ;(scott/ti ......
´´½¨Êý¾Ý¿â£ºcreate database Êý¾Ý¿âÃû;
´´½¨±í£ºcreate table ±íÃû £¨ ÁÐÃû Êý¾ÝÀàÐÍ not null... £©;
²é¿´ÏµÍ³ÖÐËùÓеÄÊý¾Ý¿â£ºshow databases;
Ñ¡ÔñÒªÓ¦ÓõÄÊý¾Ý¿â£ºuse Êý¾Ý¿âÃû;
²é¿´Ä³¸öÊý¾Ý¿âϵÄËùÓÐ±í£ºshow tables;
²é¿´±í½á¹¹£ºdesc(describe) ±íÃû;
ÖØÃüÃû±íÃû£ºalter table ±íÃû rename as бíÃû
¸ ......