2014.9.3 database Crud

Source: Internet
Author: User

CRUD Additions and deletions change

DCL Data Control Language: Backup,Grant

DML Data Manipulation language: CRUD

DDL Data Definition language:create drop alter

Self-growing columns cannot be assigned a value

Increase:

Insert into table name values(' ', ' ', ' ', ' ', ')--into can be omitted

By deleting:

Delete from table name (with log) (slow) truncate table name (does not write log, next execution self-growth column starts from 1 ) (FAST)

Delete from table where column name relationship operator value

Change:

Update table from set column name = value, column name = value,... , where Column name relational operator value

Check:

Select * from table

Select column name, column name,... from table

Select * from table where column name relational operator value and column name relational operator value

Select * from table where column between ten and (range query)

Select * from column where column in (3,4,5)

Select distinct column from table (column to weight)

Select * from car where name is like%5%% any number of arbitrary characters;_ an arbitrary character

Filtering on Columns--projection

Filter on Rows--filter

Row-Record ( tuple ) column--field ( Properties )

1 Select *  fromFruit2 Select *  fromFruitwhereStackinch(3,4,5)3 Select *  fromCarwhereName like  '%5%'--wildcard character% _4 Select *  fromCarwhereName like '% Type'5 Select *  fromCarwhereName like 'PO%'6 Select *  fromCarwhereName like '% Type'7 Select *  fromCarwhereName like '__[3,5]%'--the brackets indicate the choice8 --Sort9 Select *  fromCarOrder  byPrice--AscendingTen Select *  fromCarOrder  byPricedesc  --Descending One Select *  fromCarOrder  byPrice,oilASC, exhaustdesc A Select *  fromCarwherePrice> - Order  by Price - --Statistics of 5 - Select COUNT(*) fromCarwhereName like 'Audi%'--how many records did the Audi start with? the Select AVG(Price) fromCar--statistics car All records the average of price - Select SUM(Price/Oil fromCar - Select *, (Price*0.9) JIU fold fromCar - SelectCode code, name fromCar + Select MAX(Price) fromCar - Select *  fromCarwherePriceinch(Select MIN(Price) fromCar--find the record where the minimum value is located (row) +  A --Grouping at SelectOilCOUNT(*) fromCarGroup  byOilOrder  by COUNT(*) - SelectOilCOUNT(*) fromCarwherePrice> - Group  byOilOrder  by COUNT(*) - SelectBrandMAX(Price) fromCarGroup  byBrand - SelectBrandMin(Price) fromCarGroup  byBrand -  - SelectOilCOUNT(*) fromCarGroup  byOil having COUNT(*)>=2   --having group after filtering in --Group statistics According to social Security numbers; Number of filters greater than 1 - SelectStack fromFruitGroup  byStack having COUNT(*)>1

2014.9.3 database Crud

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.