SQL update records detailed instance updates
Syntax:
[WITH <common_table_expression> [... n]
UPDATE
[TOP (expression) [PERCENT]
{Table_alias | <object> | rowset_function_limited
[WITH (<Table_Hint_Limited> [... n])]
}
| @ Table_variable
}
SET
{Column_name = {expression | DEFAULT | NULL}
| {Udt_column_name. {property_name = expression
| Field_name = expression}
| Method_name (argument [,... n])
}
}
| Column_name {. WRITE (expression, @ Offset, @ Length )}
| @ Variable = expression
| @ Variable = column = expression
| Column_name {+ = |-= | * = |/= | % = | & = | ^ = | =} expression
| @ Variable {+ = |-= | * = |/= | % = | & = | ^ = | =} expression
| @ Variable = column {+ = |-= | * = |/= | % = | & = | ^ = | =} expression
} [,... N]
[<OUTPUT Clause>]
[FROM {<table_source>} [,... n]
[WHERE {<search_condition>
| {[CURRENT
{[GLOBAL] cursor_name}
| Cursor_variable_name
}
]
}
}
]
[OPTION (<query_hint> [,... n])]
[;]
<Object >::=
{
[Server_name. database_name. schema_name.
| Database_name. [schema_name].
| Schema_name.
]
Table_or_view_name}
Php tutorial for instances
<? Php
Mysql tutorial _ connect ("mysql153.secureserver.net", "java2s", "password ");
Mysql_select_db ("java2s ");
$ Query = "UPDATE Employee SET salary = '39. 99 '";
$ Result = mysql_query ($ query );
Echo "There were". mysql_affected_rows (). "product (s) affected .";
?>
Update Data
<? Php
Mysql_connect ("mysql153.secureserver.net", "java2s", "password ");
Mysql_select_db ("java2s ");
$ Fig = "0001 ";
$ Name = "Kate ";
$ Price = "12 ";
$ Query = "UPDATE Employee SET name = '$ name', price =' $ price' where id = '$ rowid '";
$ Result = mysql_query ($ query );
If ($ result)
Echo "<p> The developer has been successfully updated. </p> ";
Else
Echo "<p> There was a problem updating the developer. </p> ";
?>