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