SQL Getting Started Tutorial: SQL INSERT and update simple tutorial

Source: Internet
Author: User

SQL Getting Started Tutorial: SQL INSERT and update simple tutorial

Okay, let's start with the SQL Insert Tutorial.

The declaration that is inserted is used to insert a new record table.

In the Insert Declaration
The Insert Declaration is used to insert a new column in a table.

Database Insert Syntax
May be written in two forms of insert speech.

The first form of data without specific column names will be inserted, with only their values:

INSERT into table_name
VALUES (value1, value2, Value3,...)
  
  

The second form specifies the column name and insert:

INSERT into table_name (column1, Column2, Column3,...)
VALUES (value1, value2, Value3,...)
OK, let's take a look at the SQL Update Tutorial.
    
    

The UPDATE statement is used to update the record table.




UPDATE statement
The UPDATE statement is used to update the existing record table.

Updated SQL syntax

UPDATE table_name
SET column1=value, column2=value2,...
WHERE Some_column=some_value

Take a look at an updated example. Let's watch the table ' a ' first.

Address City
_id LastName FirstName
1 Hansen Ola TIMOTEIVN 10 Sandnes
2 Svendson Tove BORGVN 23 Sandnes
3 Pettersen Kari STORGT 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger
5 Tjessem Jakob

Then execute the following SQL UPDATE statement.

UPDATE a SET address= ' Nissestien ', city= ' Sandnes ' WHERE lastname= ' Tjessem ' and firstname= ' Jakob '
 
       
        Address 
           City 
         
_id LastName FirstName
1 Hansen Ola TIMOTEIVN 10 Sandnes
2 Svendson Tove BORGVN 23 Sandnes
3 Pettersen Kari STORGT 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger
5 Tjessem Jakob Nissestien 67 Sandnes
This is the record we want to update Firstname= ' Jakob '.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.