Section II Manipulating Database data

Source: Internet
Author: User

1. Retrieving data

A query is a way to extract information from a database. Structured Query Language (SQL) is the standard relational database query language.

Data is stored in a table (row), which is made up of columns (column).

(1) The simplest form of inquiry consists of two parts: the select list, which specifies the column to retrieve, and the FROM clause, which specifies the table to be accessed.

  Select CustomerName from CustomerInfo

  (2) The WHERE clause specifies the criteria for selecting a data row.

SELECT * from customerinfo where CustomerID = 48

  (3) The ORDER BY clause can sort the data in some order, based on one or more columns.

  SELECT * from CustomerInfo where State = 4 ORDER by Regtime DESC

2. Inserting data

The second important task is to add data to the database (for example, insert several rows). You can use the INSERT statement to complete.

  Insert into CustomerInfo (Customername,[password],email,compname, [State],regtime) VALUES (' APPLE ', ' 123456 ', ' [Email Protected] ', ' APPLE ', 4, ' 2014-12-25 ')

3. Updating data

The third important task is to modify the data. You can do this by using the UPDATE statement.

  Update ProjectInfo Set state = 4 where CustomerID = 48

4. Delete data

The last important task is to delete the data. You can do this by using the DELETE statement. Delete Deletes the entire row of data.

  Delete from CustomerInfo where CustomerID = 90

In summary, it is the most basic crud operation.

  

Section II Manipulating Database data

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.