Global GuideLine Home HTML Tutorial JavaScript Tutorial SQL Tutorial CSS Tutorial SEO Tutorial XML Tutorial XSLT Tutorial Articles Tutorial Interview Questions and Answers Guide Jobs GuideLine Bookmark With Google Bookmark With Yahoo Bookmark With FaceBook Bookmark With Live Follow @GlobalGuideLine on Twitter Bookmark Global GuideLine
SQL Update Statement, SQL Tutorial, Global Guide Line Technology.
Bookmark this webpage. Bookmark: SQL Update Statement, SQL Tutorial Global Guideline is UNITED STATES's favorite website

      Home                    

Basic SQL Guide.           
SQL Introduction.               
 What is Table?                  
 SQL Create Table.            
 SQL Insert Statement.      
 SQL Select Keyword.        
 SQL Order by clause.        
 SQL Count Statement.      
 SQL Group By Clause.      
 SQL Having Clause.          
 SQL Alias Tables.             
 SQL Join Tables.              
 SQL Outer Join.               
 SQL Update Statement.
 SQL Delete Statement.    
 SQL Distinct Keyword.      
 SQL Where Keyword.       
 SQL And Or Keyword.      
 SQL In Keyword.              
 SQL Between Keyword.   
 SQL Like Keyword.          
 SQL Functions.                
 SQL Concatenate.           
 SQL Substrings.               
 SQL Trim Function.         
 SQL Constraints.              
 SQL Primary Key.            
 SQL Foreign Key.            
 SQL Cerate Views.           
 SQL Create Index.           
 SQL Alter Table.             
 SQL Drop Table.             
 SQL Truncate Table.      
 SQL Summary.                

SQL Tutorial >> SQL Update Statement.


     Back             Next     



Once there's data in the table, we might find that there is a need to modify the data. To do so, here in SQL Tutorial we can use the UPDATE command to do so. The syntax for SQL Update Statement is as under

Syntax for SQL Update Statement

UPDATE "table_name"
SET "column_1" = [new value]
WHERE {condition}

For example, say we currently have a table as below and we want to update it.:
 Table Employees_Salary

FirstName Month Salary
Austin February 1100$
Creston February 1100$
Kate February 1100$
Angela February 1000$
Bobbi February 1200$

and now suppose we need to change the salary for Angela from 1000$ to 1200$ , for that particular entry needs to be updated. To do so, we use the following SQL Update Statement

Example of SQL Update Statement

UPDATE Employees_Salary
SET Salary = 1200
WHERE FirstName = "Angela"


The resulting table would look like

Result of SQL Update Statement Example:

FirstName Month Salary
Austin February 1100$
Creston February 1100$
Kate February 1100$
Angela February 1200$
Bobbi February 1200$

In this case, there is only one row that satisfies the condition in the SQL WHERE clause. If there are multiple rows that satisfy the condition, all of them will be modified.

It is also possible to UPDATE multiple columns at the same time. The syntax for update multiple columns in this case would look like the following, and this SQL Tutorial section will cover all the needs of SQL update statement clause.

UPDATE "table_name"
SET column_1 = [value1], column_2 = [value2]
WHERE {condition}

     Back             Next     
 
In order to link this page as Reference, click on below text area and pres (CTRL-C) to copy the code in clipboard or pres right click then copy the following lines after that past into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code:

[ About ] [ Contact ] [ Home ]
[ Links ] [ Site Map ] [ Services ] [ Privacy ]

Copyright © 2005-2006 www.globalguideline.com All rights reserved. Join Global Guide Line community. 180 visitors are online now