Data Type Detectives
数据类型侦探
CRUD Command Center
CRUD 指挥中心
Danger Zone
危险区域
JOIN Squad
JOIN 小队
Aggregate Arena
聚合函数竞技场
100

Which SQL Server data type stores whole numbers like 1, 25, or 300?
哪种 SQL Server 数据类型用于存储整数?

INT

100

In CRUD, which SQL command is used for READ?

在 CRUD 中,READ 对应哪条 SQL 命令?

SELECT

100

What is the most dangerous missing part in this SQL?

UPDATE Users SET Plan = 'VIP';

这条 SQL 最危险的是缺少什么?

Missing WHERE

100

What does an INNER JOIN return?
INNER JOIN 返回什么?

Only matching rows from both tables

只返回两张表中能够匹配的记录。

100

Which aggregate function counts rows?

哪个聚合函数用于统计行数?

COUNT()

200

Which data type should we use for Chinese names, item names, and text?

中文姓名、商品名称、文本应该使用哪种数据类型?

NVARCHAR( )

200

Which CRUD operation adds a new row into a table?

哪一种 CRUD 操作会向表中添加新行?

INSERT

200

Before running an UPDATE or DELETE, what safer command should you run first using the same WHERE condition?

运行 UPDATE 或 DELETE 之前,最好先用相同的 WHERE 条件运行什么命令?

Run SELECT first to confirm which rows will be affected. 

200

Why do we use table aliases like Students学生 AS s?

为什么使用表别名,比如 Students学生 AS s?

To make queries shorter and clearer

Aliases reduce typing and avoid confusion when tables share column names.

200

Which aggregate function calculates the average value?

哪个聚合函数用于计算平均值?

AVG()

300

 A column stores a calendar date like '2026-04-27'. Which data type should it use, and does the value need quotes?

如果一列存储日期,比如 '2026-04-27',应该使用什么数据类型?值需要引号吗?

DATE

300

Which command should you use to change an existing row, for example changing one student's grade from 65 to 70?

如果要修改已有行,比如把某个学生成绩从 65 改成 70,应该使用哪条命令?

UPDATE

300

True or False:
A DELETE without WHERE can remove every row in the table.

判断对错:没有 WHERE 的 DELETE 可能删除表中的所有行。

True

DELETE without WHERE is dangerous because it targets all rows.

300

In this alias, what does s represent?

SELECT s.NAME姓名
FROM Students学生 AS s

s is a nickname/alias for Students学生.

s 是 Students学生 表的别名。

300

Which aggregate function finds the highest value?

哪个聚合函数用于找出最大值?

MAX()

400

 A column stores prices like 12.50 or 29.90. Which data type is best?

如果一列存储价格,比如 12.50 或 29.90,最适合的数据类型是什么?

DECIMAL(12,2)

400

Which command removes existing rows from a table?

哪条命令会从表中删除已有行?

DELETE

400

A row in Customers客户 is referenced by rows in Orders订单. Why might deleting that customer fail?

如果 Orders订单 表中有订单引用了 Customers客户 中的某个客户,为什么删除该客户可能失败?

Foreign Key constraint / Referential integrity

The database prevents broken links: orders cannot point to a customer that no longer exists.

400

Complete the JOIN condition:
补全连接条件:

SELECT s.Name, a.Name, a.Score
FROM Students学生 AS s
INNER JOIN Assignments作业 AS a
ON ________ = ________;

ON s.StudentID学号 = a.StudentID学号;

The shared key connects the two tables.

400

What does this alias do?

SELECT AVG(Score分数) AS AvgScore平均分
FROM Assignments作业;

It names the result column AvgScore平均分.

AS gives the output column a readable label.

500

A column named IsPaid是否付款 stores 1 for paid and 0 for not paid. What data type should it use?

IsPaid是否付款 用 1 表示已付款,0 表示未付款。应该使用哪种数据类型?

BIT

500

Classify these commands as CRUD:
把这些命令对应到 CRUD:
SELECT = ?
INSERT = ?
UPDATE = ?
DELETE = ?

READ
CREATE
UPDATE
DELETE

500

Fix this dangerous SQL so it only changes the song with SongID = 204:

UPDATE Songs
SET Plays = '28.3亿';

UPDATE Songs
SET Plays = '28.3亿'
WHERE SongID = 204;

500

Write a query to show each student's name, assignment ID, and score using an INNER JOIN.
写一条 SQL,使用 INNER JOIN 显示学生姓名、作业编号、分数。


SELECT s.StudentName姓名, a.AssignID作业号, a.Score分数
FROM Students学生 AS s
INNER JOIN Assignments作业 AS a
ON s.StudentID学号 = a.StudentID学号;

500

Write a query to show the total amount of money from all paid orders.
写一条 SQL,显示所有已付款订单的总金额。

SELECT SUM(TotalPrice总金额) AS PaidTotal已付款总金额
FROM Orders订单
WHERE IsPaid是否付款 = 1;

M
e
n
u