Mysql更新

代码示例

7
0

N

UPDATE tableName SET anAttribute = 'Something' WHERE anOtherAttribute = 'SomethingElse'

//All 'SomethingElse' values will become 'Something'
6
0

N

-- Things in brackets are optional
-- IGNORE modifier updates rows even if errors occur (ie: the rows that cause errors are simply not updated)
UPDATE [IGNORE] table_name 
SET 
    column_name1 = expr1,
    column_name2 = expr2,
    ...
[WHERE 
    condition]; -- WHERE tells us which rows to update based on said condition
1
0

N

UPDATE t1
SET t1.COL1 = t2.COL1, t1.COL2 = t2.COL2
FROM MY_TABLE AS t1
INNER JOIN MY_OTHER_TABLE AS t2 ON t1.COLID = t2.ID
WHERE t1.COL3 = 'OK';
-1
0

N


        
            
        
     UPDATE employees 
SET 
    email = '[email protected]'
WHERE
    employeeNumber = 1056;Code language: SQL (Structured Query Language) (sql)

类似页面

带有示例的类似页面

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................