GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing codescracker.com — Update Existing Records in SQL
Update Existing Records in SQLIn this post, you will learn how to update the record of a table. When I say "update the record," I mean "update the row." Since each row contains one or more columns, indirectly, it is about to update the column values of any specific rows. To achieve this task, SQL provides the UPDATE statement. Here is the general form of the SQL UPDATE statement that can be used to update the records of a table. UPDATE tableName SET column1 = newValue1, column2 = newValue2, ..., columnN = newValueN WHERE condition; The WHERE clause is required to be included while updating the record of a table, until and unless you want to update all the records. Now let me create a SQL query that will update the record of a table named "customer." UPDATE customer SET email='[email protected]' WHERE id = 3; After executing the above SQL query, the column "email" will be updated with "[email protected]." Since I used the WHERE clause to only update the record whose id value is equal to 3, therefore, only that particular row will be updated. If you need to update only one record in a table, then always specify the value of the primary key. Otherwise, if you want to update multiple records, then you can choose any other condition, like to update all records whose city is "Austin," then use the following SQL query: UPDATE customer SET email='[email protected]' WHERE city='Austin'; « Previous Topic Next Topic » Practice Quizzes
Test your programming and computer science knowledge with interactive MCQs and topic-based quizzes. Popular Topics
Explore the most popular programming and computer science tutorials on CodesCracker. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |