Podcast
Questions and Answers
What is the purpose of the WHERE clause in a SQL UPDATE statement?
What is the purpose of the WHERE clause in a SQL UPDATE statement?
What does the LOW_PRIORITY option do in an UPDATE statement?
What does the LOW_PRIORITY option do in an UPDATE statement?
In the syntax of an UPDATE statement, which part indicates the new values that attributes will take?
In the syntax of an UPDATE statement, which part indicates the new values that attributes will take?
What does the LIMIT clause do in an UPDATE statement?
What does the LIMIT clause do in an UPDATE statement?
Signup and view all the answers
Which SQL command would correctly modify Martin Pierre's phone number?
Which SQL command would correctly modify Martin Pierre's phone number?
Signup and view all the answers
Study Notes
Modifying Records
- To modify one or more records in a database relation, specify a selection criterion for the records to be changed (WHERE clause).
- Indicate the attributes whose values will be changed and their new values (SET clause).
Syntax
-
UPDATE [LOW_PRIORITY] [relation] SET [attribute=value, ...] [WHERE [condition]] [LIMIT n]
-
LOW_PRIORITY
: An option that allows the update to be performed only once other reads are finished.
Example
- Changing Martin Pierre's phone number:
-
UPDATE TABLE Personnes SET telephone='0156281469' WHERE nom='Martin' AND prenom = 'Pierre'
-
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
This quiz covers the fundamentals of modifying records in a database using SQL. It focuses on the syntax of the UPDATE statement, including the WHERE and SET clauses, and provides practical examples for better understanding.