午夜精品久久久久久久99老熟妇,天堂中文www官网,未满十八18勿进黄网站,太粗太深了太紧太爽了,天天爽夜夜爽夜夜爽

考試報(bào)名
考試報(bào)名
考試內(nèi)容
考試大綱
在線客服
返回頂部

備考刷題,請(qǐng)到

CDA認(rèn)證小程序

The result table has columns A, B, C, D. Requirements: 1) Choose A if A >= B, otherwise choose B. 2) Choose C if C >= D, otherwise choose D. The correct SQL statement is:
A. select (when A>=B then A else B) MAX_AB, (when C>=D then C else D) MAX_CD from result;
B. select (case when A>=B then A else B) MAX_AB, (case when C>=D then C else D) MAX_CD from result;
C. select (case when A>=B then A else B end) MAX_AB, (case when C>=D then C else D end) MAX_CD from result;
D. select (case A>=B then A else B end) MAX_AB, (case C>=D then C else D end) MAX_CD from result;
上一題
下一題
收藏
點(diǎn)贊
評(píng)論
題目解析
題目評(píng)論(0)

Syntax for case expression: case when ... then ... else ... end

正確答案是:C: select (case when A>=B then A else B end) MAX_AB, (case when C>=D then C else D end) MAX_CD from result;

專業(yè)分析如下:

1. **SQL語法分析**:
- SQL中的`CASE`語句用于條件判斷,格式為`CASE WHEN condition THEN result ELSE result END`。
- `WHEN`和`THEN`是必須的關(guān)鍵字,`END`用于結(jié)束`CASE`語句。

2. **選項(xiàng)分析**:
- 選項(xiàng)A: `select (when A>=B then A else B) MAX_AB, (when C>=D then C else D) MAX_CD from result;`:
- 錯(cuò)誤。`WHEN`和`THEN`需要在`CASE`語句內(nèi)使用,并且缺少`CASE`和`END`關(guān)鍵字。

- 選項(xiàng)B: `select (case when A>=B then A else B) MAX_AB, (case when C>=D then C else D) MAX_CD from result;`:
- 部分正確。雖然`CASE`和`WHEN`使用正確,但缺少`END`關(guān)鍵字來結(jié)束`CASE`語句。

- 選項(xiàng)C: `select (case when A>=B then A else B end) MAX_AB, (case when C>=D then C else D end) MAX_CD from result;`:
- 正確。`CASE`語句完整且符合SQL語法,包括`CASE`、`WHEN`、`THEN`、`ELSE`和`END`關(guān)鍵字。

- 選項(xiàng)D: `select (case A>=B then A else B end) MAX_AB, (case C>=D then C else D end) MAX_CD from result;`:
- 錯(cuò)誤。`CASE`語句需要使用`WHEN`關(guān)鍵字來引入條件,而不是直接使用條件表達(dá)式。

因此,選項(xiàng)C是唯一完全符合SQL語法并且能正確執(zhí)行的選項(xiàng)。