mysql
mysql½Ì³Ì:¸ßÊÖÊÇÔõÑùÁ¶³ÉµÄ:¾«ÃîSQLÓï¾ä½éÉÜ
[ÈÕÆÚ£º2009-06-02] À´Ô´£º ×÷Õߣº
ÈçºÎ´Óһλ²ËÄñÍɱä³ÉΪ¸ßÊÖ£¬Áé»îʹÓõÄSQLÓï¾äÊDZز»¿ÉÉٵġ£±¾ÎÄÊÕ¼¯Á˲¿·Ö±È½Ï¾µä£¬³£ÓõÄSQLÓï¾ä¹©´ó¼Ò²Î¿¼£¬Ï£Íû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
¡¡¡¡ËµÃ÷£º¸´ÖƱí(Ö»¸´Öƽṹ,Ô´±íÃû£ºa бíÃû£ºb)¡¡¡¡
¡¡¡¡SQL: select * into b from a where 1<>1
¡¡¡¡ËµÃ÷£º¿½±´±í(¿½±´Êý¾Ý,Ô´±íÃû£ºa Ä¿±ê±íÃû£ºb)¡¡¡¡
¡¡¡¡SQL: insert into b(a, b, c) select d,e,f from b;
¡¡¡¡ËµÃ÷£ºÏÔʾÎÄÕ¡¢Ìá½»È˺Í×îºó»Ø¸´Ê±¼ä¡¡¡¡
¡¡¡¡SQL: select a.title,a.username,b.adddate from table a,(select max(adddate) adddate from table where table.title=a.title) b
¡¡¡¡ËµÃ÷£ºÍâÁ¬½Ó²éѯ(±íÃû1£ºa ±íÃû2£ºb)¡¡¡¡
¡¡¡¡SQL: select a.a, a.b, a.c, b.c, b.d, b.f from a LEFT OUT JOIN b ON a.a = b.c
¡¡¡¡ËµÃ÷£ºÈճ̰²ÅÅÌáÇ°Îå·ÖÖÓÌáÐÑ¡¡¡¡
¡¡¡¡SQL: select * from Èճ̰²ÅÅ where datediff('minute',f¿ªÊ¼Ê±¼ä,getdate())>5¡¡¡¡
¡¡¡¡ËµÃ÷£ºÁ½ÕŹØÁª±í£¬É¾³ýÖ÷±íÖÐÒѾÔÚ¸±±íÖÐûÓеÄÐÅÏ¢
¡¡¡¡SQL: ¡¡¡¡
¡¡¡¡delete from info where not exists ( select * from infobz where info.infid=infobz.infid
¡¡¡¡ËµÃ÷£º--
¡¡¡¡SQL: ¡¡¡¡
¡¡¡¡SELECT A.NUM, A.NAME, B.UPD_DATE, B.PREV_UPD_DATE
¡¡¡¡ from TABLE1,
¡¡¡¡ (SELECT X.NUM, X.UPD_DATE, Y.UPD_DATE PREV_UPD_DATE
¡¡¡¡ from (SELECT NUM, UPD_DATE, INBOUND_QTY, STOCK_ONHAND
¡¡¡¡ from TABLE2
¡¡¡¡ WHERE TO_CHAR(UPD_DATE,'YYYY/MM') = TO_CHAR(SYSDATE, 'YYYY/MM')) X,
¡¡¡¡ (SELECT NUM, UPD_DATE, STOCK_ONHAND
¡¡¡¡ from TABLE2
¡¡¡¡ WHERE TO_CHAR(UPD_DATE,'YYYY/MM') =
¡¡¡¡ TO_CHAR(TO_DATE(TO_CHAR(SYSDATE, 'YYYY/MM') ¦¦ '/01','YYYY/MM/DD') - 1, 'YYYY/MM') Y,
¡¡¡¡ WHERE X.NUM = Y.NUM £¨+£©
¡¡¡¡ AND X.INBOUND_QTY + NVL(Y.STOCK_ONHAND,0) <> X.STOCK_ONHAND B
¡¡¡¡WHERE A.NUM = B.NUM
¡¡¡¡ËµÃ÷£º--
¡¡¡¡SQL: ¡¡¡¡
¡¡¡¡select * from studentinfo where not exists(select * from student where studentinfo.id=student.id) and ϵÃû³Æ='"&strdepartmentname&"' and רҵÃû³Æ='"&strprofessionname&"' order by ÐÔ±ð,ÉúÔ´µØ,¸ß¿¼×ܳɼ¨
¡¡¡¡ËµÃ÷£º
¡
Ïà¹ØÎĵµ£º
Explain MySQL architecture
. - The front layer
takes care of network connections and security authentications, the
middle layer does the SQL query parsing, and then the query is handled
off to the storage engine. A storage engine could be either a default
one supp ......
Ò»¸ö¼òµ¥Ê¾Àý--
1£¬×¼±¸£ºMySQLÊý¾Ý¿âÇý¶¯°ü¡¾mysql-connector-java-5.1.10-bin.jar¡¿µ¼Èë
2£¬´´½¨²âÊÔÁ¬½ÓÖ÷³ÌÐò
package mysqlConnection;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class JdbcDemo {
public static void main(String[] args) {
......
<?php
/**
* ²Ù×÷mysql
µÄ»ù´¡À࣬ÆäËüÓëmysqlÓйصÄÀ඼¼Ì³ÐÓÚ´Ë»ùÀà
*
* ´ËclassÖеÄ$table¶¼ÊÇÒѾ°üº¬±íǰ׺µÄÍêÕû±íÃû
*
* ver 20090717
* ʹÓ÷¶Àý
* $db = new DB('localhost','root','password','database','utf8');
* $db->debug = true;
* $db->primaryKeys = array (
* 'table_1 ......
ÏîÄ¿Òª½áÊøÁË...ÖÁÉÙ¿ª·¢Òª½áÊøÁË...
»ØÍ·¿´¿´×Ô¼º¾ÍÕâôһ¸öÈËÂñÍ·¿ª·¢ÁË4¸öÔ£¬ÒÔ¼°ÊÖÉÏÄõ½µÄÓë×Ô¼º¸¶³öÍêÈ«²»³ÉÕý±ÈµÄ΢±¡¹¤×Ê£¬¾õµÃ×Ô¼ºÕætmdµÄ±¯¾ç£¡
»òÐíÕâ¾ÍÊÇÓ¦½ì±ÏÒµÉúµÄÃü°É...¶÷£¬ÏÖÔÚÎÒÒѾ²»ÊÇÓ¦½ì±ÏÒµÉúÁË...
ÏÖÔÚÏîÄ¿×öÍêÁË£¬ÎÒÒ²¾¡µ½ÁËÉÆʼÉÆÖÕµÄÒåÎñÁË...
¿àË®¾Íµ¹µ½ÕâÀ»¹ÊǻعéÕýÌâ¡£
ÓÉÓ ......