ASK Question

Quick links:
Latest articles
Internship
Members

Languages:
C
C++
C++ STL
Java
Data Structure
C#.Net
Android
Kotlin
SQL

Web:
PHP
Python
JavaScript
CSS
Ajax
Node.js
Web prog.

Programs:
C
C++
DS
Java
C#
Python


Aptitude:
C
C++
Java
DBMS

Interview:
C
Embedded C
Java
SEO
HR

CS Subjects:
CS Basics
O.S.
Networks
DBMS
Embedded Systems
Cloud Computing
Machine learning
CS Organizations
Linux
DOS

More:
Articles
Puzzles
News/Updates


Home » SQL

SQL - UPDATE Statement (to update record in table)



SQL - UPDATE Statement: In this article, we are going to learn how to update a record using ‘UPDATE’ statement in SQL.
Submitted by Shubham Singh Rajawat, on November 13, 2017

Update statement is used to update/change any data/record that already exists in a table.

Syntax:

UPDATE table_name SET column1=value1, column2=value2, column3=value3, ...
WHERE condition;

Here,

  • table_name : name of the table into which we want to insert data.
  • column1, column2, ... : names of the columns/fields.
  • value1, value2, ... : values of the column/fields specified.
  • condition: it is the condition that defines which data is going to be updated.

We can also update multiple rows/records at a time by the changing the condition in 'WHERE clause'.

sql - update command example

Examples:

1) To update the name of the student whose Enroll_No is 3

UPDATE Student SET Student_name = 'Vaibhav' WHERE Enroll_No = 3;

This will update the name of the student to Vaibhav whose Enrollment number is 3

sql - update command example 1

2) To update city of all the students to Delhi

UPDATE Student SET City = 'Delhi';

This will update the name of the student to Vaibhav whose Enrollment number is 3

sql - update command example 2





Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com (2015-2018), Some rights reserved.