CRUD Create, modify, delete, query

Source: Internet
Author: User

Operator:

Strings are used in single-quote databases where comparisons are used =, not double equals and logical OR or logical not

CRUD Operations

A c:create adds, creates, adds data to the database.

INSERT into Fruit values (' K009 ', ' Apple ', 3.0, ' gaoqing ', 90, ') inserted into the table column

Insert into Fruit (ids,name,price,source,numbers) VALUES (' K010 ', ' Apple ', 3.0, ' gaoqing ', 90)

Two. R:retrieve search, query, query data from the database.

1. Query all select * FROM table names

2. Check the specified column select column name, column name from table name

3. Replace column name Select Ids ' codename ', Name ' name ', ' Price ', Source ' origin ' from Fruit

4. Check the specified line select * from Fruit where ids= ' K006 '

SELECT * from Fruit where price=2.4 and source= ' yantai ' query price is 2.4 and is the origin of Yantai

SELECT * from Fruit where price between 2.0 and 4.0 query prices from 2.0 to 4.0

SELECT * from Fruit where Numbers in (90,80,70) queries all 90,80,70 records

Select*from Fruit ORDER BY numbbers ASC according to numbers ascending order, if not ASC by default in ascending order

Select*from table name order BY column name desc sorted by column name descending

Select COUNT (*) from table name statistics How many data are in this table

Select AVG (column name) from table name to find the average of this column

Select SUM (column name) from the table name to find the sum of this column

Select Max (column name) from table name to find the maximum value of this column

Select min (column name) from table name to find the minimum value of this column

Three. U:update modify the data from the database table.

Update Fruit set source= ' Yantai ' where ids= ' K001 '

Four. D:delete Delete, delete data from the database.

Delete from Fruit where ids= ' K007 '

Transaction: An error has occurred and can be rolled back

Add transaction: Begin Tarn

Rollback: Rollback

CRUD Create, modify, delete, query

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.