Database calculations, sorting and searching
DiperkenalkanDalam pelajaran ini
| English | Makna |
|---|---|
| sort/sɔːt/ | |
| calculated field | |
| query/ˈkwɪərɪ/ | A request to retrieve or manipulate information, especially data in a database. |
| calculated control | |
| ascending/əˈsendɪŋ/ | |
| descending/dɪˈsendɪŋ/ | |
| operator/ˈɒpəreɪtə/ | Symbols or keywords specifying operations to perform on values or expressions. |
| wildcard/ˈwaɪldkɑːd/ |
Ask the database a question
- Databases calculate new values, sort 排序 records and search with queries. The practical exam tests all three.
Calculations
- A calculated field 计算字段 in a query 查询 works out a value per record:
Total: [Price]*[Quantity]. - A calculated control 计算控件 in a report shows a result:
=Sum([Total]). Functions: Sum, Avg, Max, Min, Count.
Which is a calculated field in a query?
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
The =Sum(...) form is a calculated control in a report.
Sorting
- Ascending 升序: A→Z, 0→9, oldest first. Descending 降序: the reverse.
- A second criterion orders ties: Surname, then FirstName.
Records are sorted by Surname, then FirstName. When is FirstName used?
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
The second criterion breaks ties.
Descending order sorts numbers from 9 to 0.
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Ascending is 0 to 9.
Queries
| operator 运算符 | example |
|---|---|
= <> |
Colour <> "Red" |
> < >= <= |
Price >= 100 |
AND |
Price < 50 AND Stock > 0 |
OR |
Colour = "Red" OR Colour = "Blue" |
NOT |
NOT "London" |
LIKE + wildcards 通配符 |
LIKE "T*"; ? one character |
Red or blue cars under 20 000, newest first: (Colour = "Red" OR Colour = "Blue") AND Price < 20000, sorted by Year descending. Without brackets every red car is selected whatever its price.
Match each criterion to what it finds.
Kesulitan 2/5 · 140 koin + bonus kecil pada penyelesaian pertama hari ini
- means any number of characters.
Which criteria find red or blue cars under 20 000?
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
The brackets keep the OR together.
Bracket the OR when mixing with AND. Otherwise AND binds first and the results are wrong.
Calculated fields work per record; calculated controls summarise. Sort ascending or descending with tie-breakers. Queries use comparison operators, AND, OR, NOT and wildcards.
Apa yang salah? Hanya tim situs yang dapat melihatnya.