Help Center>
Data Warehouse Service (DWS)>
Tool Guide>
DSC>
SQL Syntax Migration Reference>
MySQL Syntax Migrating>
Data Manipulation Language (DML)>
UPDATE>
LIMIT
Updated on 2024-04-28 GMT+08:00
LIMIT
UPDATE LIMIT syntax can be used to limit the scope. A clause is a limit on row matching. As long as the rows that satisfy the clause are found, the statements will stop, regardless of whether they have actually changed.
Input
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# LIMIT UPDATE employees SET department_id=department_id+1 LIMIT 3 ; UPDATE employees SET department_id=department_id+1 LIMIT 3 , 10 ; # LIMIT + OFFSET UPDATE employees SET department_id=department_id+1 LIMIT 3 OFFSET 2; # LIMIT + ORDER BY UPDATE employees SET department_id=department_id+1 ORDER BY fname LIMIT 3 ; # LIMIT + WHERE + ORDER BY UPDATE employees SET department_id=department_id+1 WHERE id<5 ORDER BY fname LIMIT 3 ; # LIMIT + WHERE + ORDER BY + OFFSET UPDATE employees SET department_id=department_id+1 WHERE id<5 ORDER BY fname LIMIT 3 OFFSET 2 ; |
Output
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
-- LIMIT UPDATE "public"."employees" SET "department_id" = department_id+1; UPDATE "public"."employees" SET "department_id" = department_id+1; -- LIMIT + OFFSET UPDATE "public"."employees" SET "department_id" = department_id+1; -- LIMIT + ORDER BY UPDATE "public"."employees" SET "department_id" = department_id+1; -- LIMIT + WHERE + ORDER BY UPDATE "public"."employees" SET "department_id" = department_id+1 WHERE id<5; -- LIMIT + WHERE + ORDER BY + OFFSET UPDATE "public"."employees" SET "department_id" = department_id+1 WHERE id<5; |
Parent topic: UPDATE
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot