Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

OracleDB,MySQL×Ö·û´®²Ù×÷º¯ÊýINSTR£¬SUBSTRING_INDEX

ÌâÄ¿£º¸ø¶¨Ò»¸ö·Ö¸î·û£¬ÔõÑùµÃµ½¸ø¶¨×Ö·û´®×îºóÒ»¸ö·Ö¸î·ûºóµÄ×Ö·û´®¡£ È磺‘fsb-ibees-zxj-fsbk’ ÔõÑùµÃµ½fsbk, ÒªÇó£ºjavaʵÏÖ£¬sqlʵÏÖ£¿sql¿ÉÒÔÊÇoracle£¬mysqlµÈʵÏÖ¡£
 1.OracleʵÏÖ
SET SERVEROUTPUT ON;
DECLARE
str VARCHAR2(266):='123-890-ibees-zxj';--±»½âÎöµÄ×Ö·û´®
splitStr VARCHAR2(64):= '-';--·Ö¸î×Ö·û´®
astr VARCHAR2(266); --×îºóÒ»¸ö·Ö¸î·ûºóµÄ×Ö·û´®
BEGIN
SELECT SUBSTR(str,INSTR(str,splitStr,-1,1)+1,LENGTH(str)-INSTR(str,splitStr,-1,1)+1)
INTO astr
from DUAL;

DBMS_OUTPUT.PUT_LINE(astr);
END;
/
Ö÷ÒªÊÇINSTRµÄÓ÷¨¡£¼òµ¥µÄÓ÷¨Îª:
SELECT SUBSTR('123-890-ibees-zxj',INSTR('123-890-ibees-zxj','-',-3,1)+1,LENGTH('123-890-ibees-zxj')-INSTR('123-890-ibees-zxj','-',-3,1)+1) from DUAL;
 2. MySQLʵÏÖ
SELECT SUBSTRING_INDEX('123-890-ibees-zxj','-',-1) ;
Õâ¸ö·½·¨Ö±½Ó»ñµÃ×îºóÒ»¸ö·Ö¸î·ûºóµÄ×Ö·û´®.
3.JavaʵÏÖ
String s = "jdkfdsf-sdekjre-kdkf";
String[] sarray = s.split('-');
String last = sarray[sarray.length-1];


Ïà¹ØÎĵµ£º

MySQL 5.5 °æ±¾·¢²¼

½üÈÕ£¬MySQL 5.5 µÚÒ»¸ö°æ±¾·¢²¼ÁË£¬»ùÓÚMySQl 5.4£¬µ«ÊÇÔÚÐÔÄÜÉÏÏà¶ÔÓÚµ±Ç°µÄ5.0/5.1ÓÐÁ˺ܴóµÄÌáÉý¡£
 ÐÂÌØÐÔ£º
Ö§³Ösemisynchronous £¨°ëͬ²½£©¸´Öƽӿڣ¬¿É´î½¨³öÒ»¸öÏà¶ÔÍêÃÀµÄMySQL¸ß¿ÉÓÃÐÔ·½°¸
¼¯³ÉInnodb plugin 1.0.6
Ö§³Ö SQL ±ê×¼ SIGNAL ºÍ RESIGNAL Óï¾ä
ÔöÇ¿XML¹¦ÄÜ£¬Ö§³Ö LOAD XML Óï¾ä
¿Éͨ¹ý A ......

Mysql ´¥·¢Æ÷ʵÀý

MySQL ´¥·¢Æ÷¼òµ¥ÊµÀý
1¡¢Óï·¨£º
CREATE TRIGGER <´¥·¢Æ÷Ãû³Æ>  --´¥·¢Æ÷±ØÐëÓÐÃû×Ö£¬×î¶à64¸ö×Ö·û£¬¿ÉÄܺóÃæ»á¸½Óзָô·û.ËüºÍMySQLÖÐÆäËû¶ÔÏóµÄÃüÃû·½Ê½»ù±¾ÏàÏó.
{ BEFORE | AFTER }  --´¥·¢Æ÷ÓÐÖ´ÐеÄʱ¼äÉèÖ㺿ÉÒÔÉèÖÃΪʼþ·¢ÉúÇ°»òºó¡£
{ INSERT | UPDATE | DELETE }  --ͬÑùÒ²ÄÜÉ趨´¥· ......

mysqlÐÞ¸ÄÃÜÂë(°üÀ¨ÃÜÂëÍü¼ÇµÄÇé¿ö)

ÐÞ¸ÄrootÃÜÂëµÄʱºò°´ÕÕÍøÉϵÄ˵µÄ¾ÓȻɵɵµÄÖ´ÐÐÁËupdate user set password="asdf" where user="root"£»Ö´ÐÐÖ®ºó·¢ÏÖÃÜÂë´íÁË£¬½øÈ¥²»ÁË£¬ÓÚÊÇÕÛÌÚÁË°ëÌ죬·¢ÏÖmysqlµÄÃÜÂëÊǼÓÃܵIJ»ÊÇÃ÷ÎÄ´æ´¢µÄ£¬ËùÒԸĵÄʱºòÐèÒªÕâÑùset password=password("asdf")¡£´íÎóÒѾ­·¢ÉúÁË£¬ÓÚÊǾͰ´ÕÕÏÂÃæµÄ· ......

MySQL£ºÈÕÆÚº¯Êý¡¢Ê±¼äº¯Êý×ܽᣨMySQL 5.X£©

MySQL£ºÈÕÆÚº¯Êý¡¢Ê±¼äº¯Êý×ܽᣨMySQL 5.X£©
²Î¿¼³¤ÎÄ£º
Ò»¡¢MySQL »ñµÃµ±Ç°ÈÕÆÚʱ¼ä º¯Êý
1.1 »ñµÃµ±Ç°ÈÕÆÚ+ʱ¼ä£¨date + time£©º¯Êý£ºnow()
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2008-08-08 22:20:46 |
+---------------------+
³ýÁË now() º¯ÊýÄÜ»ñµÃµ±Ç°µ ......

MySQLѧϰ±Ê¼Ç£ºInnoDBºÍMyISAMµÄ²î±ð


InnoDB
ºÍMyISAM
ÊÇÔÚʹÓÃMySQL
×î³£ÓõÄÁ½¸ö±íÀàÐÍ£¬¸÷ÓÐÓÅȱµã£¬ÊÓ¾ßÌåÓ¦Óöø¶¨¡£»ù±¾µÄ²î±ðΪ£ºMyISAM
ÀàÐͲ»Ö§³ÖÊÂÎñ´¦ÀíµÈ¸ß¼¶´¦Àí£¬¶øInnoDB
ÀàÐÍÖ§³Ö¡£MyISAM
ÀàÐ͵ıíÇ¿µ÷µÄÊÇÐÔÄÜ£¬ÆäÖ´ÐÐÊý¶È±ÈInnoDB
ÀàÐ͸ü¿ì£¬µ«ÊDz»ÌṩÊÂÎñÖ§³Ö£¬¶øInnoDB
ÌṩÊÂÎñÖ§³ÖÒѾ­Íⲿ¼üµÈ¸ß¼¶Êý¾Ý¿â¹¦ÄÜ¡£
MyIASMÊÇIASM± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ