Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » UltraLite - Database Management and Developer Guide » UltraLite SQL reference » UltraLite SQL statements

UPDATE statement [UltraLite]

Modifies rows in a table.

Syntax
UPDATE table-name[[AS] correlation-name]
SET column-name  = expression, ...
[ WHERE search-condition ]
Parameters
  • table-name

    The table-name specifies the name of the table to update. Only a single table is allowed.

  • correlation-name

    An identifier to use when referencing the table from elsewhere in the statement.

  • SET clause

    Each named column is set to the value of the expression on the right side of the equal sign. There are no restrictions on the expression. If the expression is a column-name, the old value is used.

    Only columns specified in the SET clause have their values changed. In particular, you cannot use UPDATE to set a column's value to its default.

  • WHERE clause

    If a WHERE clause is specified, only rows satisfying search-condition are updated.

Remarks

The UPDATE statement modifies values in a table.

Character strings inserted into tables are always stored in the same case as they are entered, regardless of whether the database is case sensitive.

Example

The following statement transfers employee Philip Chin (employee 129) from the sales department to the marketing department (department 400).

UPDATE Employees
SET DepartmentID = 400
WHERE EmployeeID = 129

An example using correlation-name.

UPDATE Employee E 
SET salary = salary * 1.05 
WHERE EXISTS( SELECT 1 FROM Sales S HAVING E.Sales > Avg( S.sales) 
GROUP BY S.dept_no )