Update Keywords¶
This page lists the SQL keywords and clauses used in UPDATE
statements, along with their corresponding methods in ts-sql-query
. It covers setting column values, filtering rows, using joins, returning old and new values, and engine-specific clauses like RETURNING
or OUTPUT
.
SQL Keyword | ts-sql-query Equivalent | Notes | Link |
---|---|---|---|
DELETED | table .oldValues() |
Refers to the previous value before an update. | Update returning old values, Update API |
FROM | query .from(...) |
Updates using data from another table. | Update using other tables or views, Update API |
INNER JOIN | query .innerJoin(...) |
Inner join between tables. | Update API |
INSERTED | Managed automatically by ts-sql-query |
Refers to the new value after an update. | |
JOIN | query .join(...) |
Inner join between tables. | Update API |
LEFT JOIN | query .leftJoin(...) |
Left outer join between tables. | Update API |
LEFT OUTER JOIN | query .leftOuterJoin(...) |
Left outer join between tables. | Update API |
LIMIT | Not supported yet. Use a custom SQL fragment. | Restricts the number of rows that are deleted. | Customizing an update |
OUTPUT | query .returning(...) |
Returns updated rows or specific columns (SQL Server). | Update returning, Update API |
RETURNING | query .returning(...) |
Returns updated rows or specific columns. | Update returning, Update API |
RETURNING INTO | query .returning(...) |
Returns updated rows or specific columns (Oracle). | Update returning, Update API |
SET | query .set({...}) |
Set values. | Update, Update API |
TOP | Not supported yet. Use a custom SQL fragment. | Restricts the number of rows that are deleted. | Customizing an update |
UPDATE | connection .update(table) |
Updates records in a table. | Update, Update API |
WHERE | query .where({...}) |
Filters which rows should be updated. | Update, Update API |