Database Statement 2

Source: Internet
Author: User

Check the student number and course number of the highest score in the score table. (sub-query or sort)
Select* from score where degree on (select MAX (degree) from score)

Aggregate function: Max () min () Avg () count () sum ()

Math function: Ceiling () floor () Round (field name, decimal place)

ABS () Pi ()

String function: Lower () upper () trim () Replace (source field, find character)

substring (source field, index position)

Conversion functions + operations, stitching

Convert (Type, field)

Cast (field as type)

Time-Date function:

Getdate:year (GETDATE ())

DATEADD (Increase type, increase amount, data source, DateAdd (Month,7,getdate ())

Datename (date type, data source), Datename (Day,getdate ())

Conditional query with where

For example: Query all records in the score table with scores from 60 to 80.

Select degree from score where degree>60 and degree<80

% for fuzzy queries

For example, query the data related to three:

Where CNO like ' 3% ' 3% is already three%3% is the middle Band 3%3 is the end Band 3

Sort query ORDER BY desc descending ASC Ascending to redo query distinct

Grouping query GROUP BY Union query Union

Sub-query:

Database Statement 2

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.