Zum Inhalt springen

„Update (SQL)“ – Versionsunterschied

aus Wikipedia, der freien Enzyklopädie
[ungesichtete Version][ungesichtete Version]
Inhalt gelöscht Inhalt hinzugefügt
Keine Bearbeitungszusammenfassung
Timc (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
An [[SQL]] UPDATE statememt changes data in a record (or records) in a [[relational database system]].
An '''UPDATE''' statement in [[SQL]] changes data in one or more records in a [[relational database management system]].


UPDATE statement has the following form:
UPDATE statement has the following form:
Zeile 5: Zeile 5:
'''UPDATE''' ''table_name'' '''SET''' ''column_name'' = ''value'' ['''WHERE''' ''criteriavariable'' = ''value'']
'''UPDATE''' ''table_name'' '''SET''' ''column_name'' = ''value'' ['''WHERE''' ''criteriavariable'' = ''value'']


For the UPDATE to be successfull, the user must have data manipulation privileges (UPDATE privilege) over the table or column, the updated value must not conflict with all the applicable constraints (such as primary keys, unique indexes , CHECK constraints, and NOT NULL constraints).
For the UPDATE to be successful, the user must have data manipulation privileges (UPDATE privilege) over the table or column, the updated value must not conflict with all the applicable constraints (such as [[primary key]]s, unique indexes , CHECK constraints, and NOT NULL constraints).


==Examples==
Example :


UPDATE phone_book SET number='+3592434343' WHERE name='Johnson, Albert J.'
UPDATE T SET C1 = 1 WHERE C2 = 'a'

Version vom 29. November 2004, 02:59 Uhr

An UPDATE statement in SQL changes data in one or more records in a relational database management system.

UPDATE statement has the following form:

UPDATE table_name SET column_name = value [WHERE criteriavariable = value]

For the UPDATE to be successful, the user must have data manipulation privileges (UPDATE privilege) over the table or column, the updated value must not conflict with all the applicable constraints (such as primary keys, unique indexes , CHECK constraints, and NOT NULL constraints).

Examples

UPDATE T SET C1 = 1 WHERE C2 = 'a'