尊龙凯时人生就是搏

sqlÖÐÐÞ¸ÄÊý¾ÝµÄÏÂÁîÓÐÄÄЩ

sql ÖÐÐÞ¸ÄÊý¾ÝµÄÏÂÁîÖ÷ÒªÓÐÒÔϼ¸Àࣺupdate ÏÂÁ¸üÐÂÖª×ãÌõ¼þµÄÐÐÖеÄÖ¸¶¨×Ö¶ÎÖµ ¡£delete ÏÂÁɾ³ýÖª×ãÌõ¼þµÄÐÐ ¡£insert ÏÂÁÏò±íÖвåÈëÐÂÐÐ ¡£merge ÏÂÁ½«Êý¾ÝºÏ²¢µ½±íÖУ¬Ö§³Ö¸üкͲåÈë ¡£truncate ÏÂÁ¸ßЧɾ³ý±íÖÐËùÓÐÐÐ ¡£

SQL ÖÐÐÞ¸ÄÊý¾ÝµÄÏÂÁî

SQL ÖÐÓÃÓÚÐÞ¸ÄÊý¾ÝµÄÏÂÁîÖ÷ÒªÓÐÒÔϼ¸Àࣺ

1. ¸üÐÂÏÂÁî

UPDATE ±íÃû SET ×Ö¶ÎÃû = ÐÂÖµ WHERE Ìõ¼þ£»

´ËÏÂÁîÓÃÓÚ¸üбíÖÐÖª×ãÖ¸¶¨Ìõ¼þµÄÐÐÖеÄÖ¸¶¨×ֶεÄÖµ ¡£

2. ɾ³ýÏÂÁî

DELETE FROM ±íÃû WHERE Ìõ¼þ£»

´ËÏÂÁîÓÃÓÚɾ³ý±íÖÐÖª×ãÖ¸¶¨Ìõ¼þµÄÐÐ ¡£

3. ²åÈëÏÂÁî

INSERT INTO ±íÃû (×Ö¶ÎÃû1, ×Ö¶ÎÃû2, …) VALUES (Öµ1, Öµ2, …);

´ËÏÂÁîÓÃÓÚÏò±íÖвåÈëÐÂÐУ¬²¢ÎªÖ¸¶¨µÄ×Ö¶ÎÖ¸¶¨Öµ ¡£

4. ºÏ²¢ÏÂÁî

MERGE INTO ±íÃû USING Êý¾ÝÔ´ ON (ÅþÁ¬Ìõ¼þ) WHEN MATCHED THEN UPDATE SET … WHEN NOT MATCHED THEN INSERT …;

´ËÏÂÁîÓÃÓÚδÀ´×ÔÊý¾ÝÔ´ÖеÄÊý¾ÝºÏ²¢µ½±íÖÐ ¡£Ëüͬʱ֧³Ö¸üкͲåÈë²Ù×÷ ¡£

5. ½Ø¶ÏÏÂÁî

TRUNCATE TABLE ±íÃû£»

´ËÏÂÁîÓÃÓÚɾ³ý±íÖеÄËùÓÐÐУ¬±È DELETE ÏÂÁî¸ü¸ßЧ ¡£

ʾÀý£º

¸üбíÖÐÖª×ãÌõ¼þµÄÐУº

UPDATE customers SET city = 'New York' WHERE state = 'NY';

µÇ¼ºó¸´ÖÆ

ɾ³ý±íÖÐÖª×ãÌõ¼þµÄÐУº

DELETE FROM orders WHERE order_date <p><strong>Ïò±íÖвåÈëÐÂÐУº</strong></p><pre class="brush:php;toolbar:false">INSERT INTO products (product_name, price) VALUES ('Apple', 10.00);

µÇ¼ºó¸´ÖÆ

ʹÓúϲ¢ÏÂÁîºÏ²¢Êý¾Ý£º

MERGE INTO customers
USING new_customers
ON (customer_id)
WHEN MATCHED THEN UPDATE SET first_name = new_customers.first_name
WHEN NOT MATCHED THEN INSERT (customer_id, first_name, last_name)
VALUES (new_customers.customer_id, new_customers.first_name, new_customers.last_name);

µÇ¼ºó¸´ÖÆ

ÒÔÉϾÍÊÇsqlÖÐÐÞ¸ÄÊý¾ÝµÄÏÂÁîÓÐÄÄЩµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼ ¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý ¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ