sqlÖÐÐ޸ıíÖÐÊý¾ÝµÄÏÂÁîÊÇ
sql ÖÐ×î³£ÓõÄÐ޸ıíÖÐÊý¾ÝµÄÏÂÁîÊÇ update£¬ÓÃÓÚ¸üÐÂÖª×ãÌõ¼þµÄÐеÄÖ¸¶¨ÁеÄÊý¾Ý¡£ÏÂÁîÓï·¨ÈçÏ£ºupdate table_name set column_name = new_value where condition;¡£ÀýÈ磺update customers set address = ‘123 main street’ where name = ‘john’ and age > 30; »á½«±í “customers” ÖÐ “name” ÁÐΪ “john” ÇÒ “age”
SQL ÖÐÐ޸ıíÖÐÊý¾ÝµÄÏÂÁî
SQL ÖÐ×î³£ÓõÄÐ޸ıíÖÐÊý¾ÝµÄÏÂÁîÊÇ£º
UPDATE
Óï·¨£º
UPDATE table_name SET column_name = new_value WHERE condition;
µÇ¼ºó¸´ÖÆ
×÷Óãº
UPDATE ÏÂÁîÓÃÓÚ¸üÐÂÖ¸¶¨±íÖÐÖª×ãÌõ¼þµÄÐеÄÖ¸¶¨ÁÐÖеÄÊý¾Ý¡£
²ÎÊý£º
table_name£ºÒª¸üеıíÃû¡£
column_name£ºÒª¸üеÄÁÐÃû¡£
new_value£ºÒª¸üÐÂΪµÄÐÂÖµ¡£
condition£º¿ÉÑ¡£¬Ö¸¶¨Òª¸üеÄÐС£ÈôÊDz»Ö¸¶¨Ìõ¼þ£¬Ôò¸üбíÖеÄËùÓÐÐС£
ʾÀý£º
ÒÔÏÂÏÂÁ±í “customers” ÖÐ “name” ÁÐΪ “John” ÇÒ “age” ÁдóÓÚ 30 µÄËùÓÐÐÐµÄ “address” ÁиüÐÂΪ “123 Main Street”£º
UPDATE customers SET address = '123 Main Street' WHERE name = 'John' AND age > 30;
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇsqlÖÐÐ޸ıíÖÐÊý¾ÝµÄÏÂÁîÊǵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡