Komputasi III: Membangun, Mengkuery, dan Menjelaskan Aplikasi Web Database
GAC Informatika Topik 3 21:11 Narasi bahasa Inggris · takarir bahasa Inggris dan 中文 yang dapat dipilih
Bab-bab
Transkrip
Computing III asks you to connect a website to data and use SQL to support decisions.
计算机III要求你把网站和数据连接起来,并用 SQL 来支持决策。
Our practical question is which classes have places left.
我们的实践问题是:哪些班级还有空位。
The records are invented for learning, so the result is not an actual school booking recommendation.
这些记录是为学习编造的,所以结果不是真正的学校选课建议。
We will trace a complete request, create three related tables, calculate totals and display them in a browser.
我们会追踪一个完整的请求,创建三张相关的表,计算总数,并在浏览器中显示出来。
The existing notes stay in place, with separate practical notes providing the detailed example.
现有的笔记保持不变,另外的实践笔记提供详细的例子。
Follow the current centre guide for assessed depth, required tools and submission evidence.
评估的深度、所需工具和提交证据,以中心目前的指南为准。
The front end runs in the reader's browser.
前端运行在读者的浏览器中。
The back end receives requests on a server.
后端在服务器上接收请求。
In this example the SQLite database runs inside that server process.
在这个例子里,SQLite 数据库运行在那个服务器进程内部。
The browser does not receive a database password or run the server's SQL.
浏览器不会收到数据库密码,也不运行服务器的 SQL。
It asks for course data through an API.
它通过一个 API 请求课程数据。
The server returns data, and the browser turns that data into visible table cells.
服务器返回数据,浏览器把这些数据变成可见的表格单元格。
Keeping these jobs distinct helps you locate a fault: wrong totals suggest the data or query, while correct JSON with a broken table suggests the browser code.
把这些分工分清楚,有助于你定位故障:总数错了,说明问题在数据或查询;JSON 正确而表格坏了,说明问题在浏览器代码。
A route connects a request path to the code that handles it.
路由把一个请求路径和处理它的代码连接起来。
The example's course route accepts a minimum enrolment count.
例子中的课程路由接受一个最低选课人数。
A browser number field helps a reader, but another caller can send a request directly.
浏览器的数字输入框能帮助读者,但其他调用者可以直接发送请求。
The server must therefore enforce its own input rule.
所以服务器必须执行自己的输入规则。
Keep SQL structure fixed and bind the accepted number as a value.
让 SQL 结构保持固定,把接受的数字作为值绑定进去。
Return a useful status when the input is invalid, the route is missing or a request method is unsupported.
当输入无效、路由不存在或请求方法不受支持时,返回一个有用的状态。
Validation, binding and response handling have different jobs; one does not replace the others.
验证、绑定和响应处理各有各的作用;一个不能代替另一个。
One student may take several courses, and one course may contain several students.
一个学生可以选几门课,一门课也可以有几个学生。
Two tables alone cannot represent both directions without awkward repeated values.
只用两张表,无法在不笨拙地重复数值的情况下表示两个方向的关系。
An enrolment table holds one student and course pair per row.
选课表每一行保存一个学生和一门课程的配对。
It links to the student table and the course table using their IDs.
它通过 ID 链接到学生表和课程表。
The same student ID may appear in several different pairs, as may the same course ID.
同一个学生 ID 可以出现在几个不同的配对里,同一个课程 ID 也一样。
The pair itself is unique.
配对本身是唯一的。
This design also avoids repeating the student's name in every enrolment row, so a name correction happens in one place.
这种设计还避免了在每一条选课记录里重复学生的名字,所以改正一个名字只需要在一个地方改。
SQL lets you select, relate and summarise stored records.
SQL 让你选择、关联和汇总存储的记录。
A join connects matching keys.
连接把相匹配的键连在一起。
A where condition selects individual rows before grouping, while a having condition checks a group result such as its count.
where 条件在分组之前选出单独的行,而 having 条件检查分组的结果,比如它的计数。
The original notes include a class-total query.
原有笔记里有一个班级总数的查询。
Our practical example extends it by grouping by a unique class ID and retaining classes with no enrolments.
我们的实践例子对它做了扩展:按唯一的班级 ID 分组,并保留没有人选的班级。
These details matter: a query can run successfully while merging different classes or hiding an empty one.
这些细节很重要:一个查询可能运行成功,却把不同的班级合并了,或者把空班级藏起来了。
Always compare its result with a small dataset whose answers you can check by hand.
一定要用一个你能手算出答案的小数据集来对照它的结果。
The server prepares a SQL statement and passes the accepted minimum separately.
服务器准备一条 SQL 语句,并把接受的最小值单独传进去。
Binding protects this query from treating that value as SQL syntax.
绑定保护这个查询,不会把那个值当作 SQL 语法。
It does not prove the whole application is secure, and values do not substitute for column names or keywords.
它并不能证明整个应用都是安全的,而且值也不能代替列名或关键字。
The rows are returned as JSON data.
返回的行是 JSON 数据。
If no courses meet the minimum, the server still completed a valid query.
如果没有课程达到最低人数,服务器仍然完成了一次有效的查询。
It returns an empty array with a success status.
它返回一个空数组和一个成功状态。
The browser must handle that result as a normal state, rather than assuming every successful response contains a row.
浏览器必须把这个结果当作一种正常状态来处理,而不是认为每个成功的响应都包含数据行。
A data project starts with a question and checks whether the available records can answer it.
数据项目从一个问题开始,并检查现有的记录能否回答它。
Clean missing or inconsistent values, check duplicate relationships and confirm that keys refer to real records.
清理缺失或不一致的值,检查重复的关系,确认键指向真实存在的记录。
Then calculate a summary suited to the question.
然后计算一个适合这个问题的汇总。
Our class totals describe current enrolments and spare capacity.
我们的班级总数描述的是当前的选课人数和剩余容量。
They cannot explain why students chose a course or whether teaching improved learning.
它们不能解释学生为什么选某门课,也不能说明教学是否改善了学习。
A clear report states these limits and separates its observation from a proposed next action.
一份清楚的报告会说明这些局限,并把观察和提议的下一步行动分开。
A chart can show a pattern clearly without establishing a cause.
图表可以清楚地显示一种规律,但不能确立原因。
Follow one request rather than memorising three disconnected files.
跟踪一个请求,而不是去背三个互不相关的文件。
The reader enters two and submits the form.
读者输入2并提交表单。
The browser requests the course API with min equal to two.
浏览器请求课程 API,参数 min 等于2。
The server checks that this is one permitted whole number, binds it into the prepared query and receives the grouped rows.
服务器检查这是一个允许的整数,把它绑定到准备好的查询中,得到分组后的行。
The response is a JSON object containing the accepted minimum and a course array.
响应是一个 JSON 对象,包含接受的最小值和一个课程数组。
The browser checks the status, reads the object and makes table cells.
浏览器检查状态,读取这个对象,并生成表格单元格。
Only course ten meets this minimum in the original dataset.
在原始数据集中,只有10号课程达到这个最低人数。
The supplied source includes a complete server, a complete browser page and a SQL seed file.
提供的源代码包括一个完整的服务器、一个完整的浏览器页面和一个 SQL 初始数据文件。
Save the page's downloaded text copy as index dot HTML.
把页面下载的文本副本保存为 index.html。
Run the server with a compatible Node runtime and open the address it prints.
用兼容的 Node 运行环境运行服务器,然后打开它打印出来的地址。
You do not need an account or a package installation.
你不需要账号,也不需要安装任何包。
The server uses a fresh in-memory database every time it starts, so browser results do not save edits.
服务器每次启动都使用一个全新的内存数据库,所以浏览器里的结果不会保存修改。
If a port is occupied, choose an automatic port rather than stopping someone else's process.
如果某个端口被占用,就选择一个自动分配的端口,而不是停掉别人的进程。
This is a local teaching example, not a public service.
这是一个本地教学示例,不是公开的服务。
Draw the relationships before writing a query.
写查询之前,先画出关系。
Student one has two enrolment pairs, linking to classes ten and twenty.
1号学生有两个选课配对,分别链接到10号和20号班级。
Class ten has three pairs, linking to students one, two and three.
10号班级有三个配对,分别链接到1、2、3号学生。
These links explain the many-to-many relationship directly.
这些链接直接说明了多对多关系。
A pair holds IDs, not repeated names and course titles.
一个配对保存的是 ID,而不是重复的名字和课程标题。
Changing Mei's name therefore does not require changing every enrolment she has.
所以改梅的名字,不需要改她的每一条选课记录。
Course IDs also separate classes that happen to share a title.
课程 ID 也能把碰巧同名的班级分开。
Names are display information; IDs provide the identity used by the relationships.
名字是用来显示的信息;ID 提供关系所使用的身份。
The student and course tables are the parents of enrolment links.
学生表和课程表是选课链接的父表。
Their integer primary keys identify individual records.
它们的整数主键标识每一条记录。
Not null prevents a required field from being absent, while the capacity check rejects a negative value.
not null 防止必填字段缺失,而容量检查拒绝负数。
These are specific rules, not a general guarantee that the data is correct.
这些是具体的规则,而不是数据正确的总体保证。
For example a non-empty name could still be misspelled, and a capacity could be entered incorrectly while remaining non-negative.
例如,一个非空的名字仍可能拼错,一个容量也可能输错了却仍然不是负数。
Explain what each constraint enforces and what it leaves for other checks.
解释每个约束强制了什么,以及它把什么留给了其他检查。
The complete seed script creates these tables in a fresh database.
完整的初始化脚本会在一个全新的数据库里创建这些表。
The enrolment table references both parent tables.
选课表引用两张父表。
With foreign-key checking enabled, a pair cannot refer to a missing student or course.
启用外键检查后,一个配对不能引用不存在的学生或课程。
The script turns this checking on explicitly.
脚本明确地打开了这项检查。
Its composite primary key makes the student and course pair unique.
它的复合主键让学生和课程的配对唯一。
Student one can join another class, but cannot be entered twice in the same class.
1号学生可以加入另一个班级,但不能在同一个班级里被录入两次。
A rejected pair does not cause SQLite to create the missing parent.
一个被拒绝的配对不会让 SQLite 去创建缺失的父记录。
These protections are visible in the practical tasks, which deliberately try a duplicate pair and a reference to student ninety-nine.
这些保护在实践任务中都能看到,任务故意尝试一个重复的配对和一个指向99号学生的引用。
It is tempting to think that storing capacity three prevents four students joining.
人们容易以为,存储容量3就能防止第四个学生加入。
It does not.
并不能。
The database check only requires the stored capacity to be non-negative.
数据库的检查只要求存储的容量不是负数。
The paired enrolment keys prevent duplicate pairs and missing references, but they do not compare the total with capacity.
配对的选课键防止了重复配对和缺失的引用,但它们并不把总数和容量进行比较。
This example deliberately exposes no booking operation.
这个例子故意没有提供选课操作。
A real operation would need a capacity rule and safe handling of simultaneous requests, so two bookings cannot both use the same final place.
一个真实的操作需要一条容量规则,并安全地处理同时到达的请求,这样两次选课就不会同时占用最后一个名额。
State this boundary when explaining what your example demonstrates; do not present it as a finished enrolment system.
解释你的例子展示了什么时,要说明这条边界;不要把它说成一个完成的选课系统。
Pause and attempt this practice task before the solution.
暂停,先试着做这道练习,再看解答。
Classes 10 and 20 are both called Coding, with three and one enrolments.
10号和20号班级都叫 Coding,分别有3人和1人选课。
What would grouping only by title count?
如果只按标题分组,会算出什么?
Explain which grouping fields preserve the intended class-level question.
解释哪些分组字段能保持我们想问的“按班级”的问题。
The two Coding classes make an important query mistake visible.
这两个 Coding 班级让一个重要的查询错误变得显而易见。
Class ten has three enrolments and class twenty has one.
10号班级有3人选课,20号班级有1人。
If the query groups only by title, both classes become one Coding group with a count of four.
如果查询只按标题分组,两个班级就变成一个 Coding 组,计数为4。
That might be correct for a question about titles, but it is wrong for a question about individual classes and their available places.
对于一个关于标题的问题,这可能是对的,但对于关于单个班级及其空位的问题,这是错的。
Group by the course ID as well as the displayed title and capacity.
除了显示的标题和容量,还要按课程 ID 分组。
Decide the unit being summarised before choosing a grouping key.
选择分组键之前,先决定要汇总的单位是什么。
A result that looks plausible still needs this identity check.
一个看起来合理的结果,仍然需要做这个身份检查。
An inner join returns only courses with a matching enrolment.
内连接只返回有匹配选课记录的课程。
That would hide Music, precisely the class with the most spare places.
这会把 Music 藏起来,而它恰恰是空位最多的班级。
A left join starts with the course table and preserves each course even when there is no matching enrolment row.
左连接从课程表开始,即使没有匹配的选课行,也保留每一门课程。
The unmatched enrolment fields are empty.
没有匹配的选课字段是空的。
Count the matched student ID, which is not null in a real enrolment, to get zero for Music.
计算匹配到的学生 ID,在真实的选课记录中它不为空,这样 Music 的结果就是0。
This is why the left table and the counted expression both matter.
这就是为什么左表是哪张、计数的表达式是什么,两者都很重要。
Check the output against all four expected courses before trusting a larger dataset.
在信任一个更大的数据集之前,先用全部四门预期的课程来检查输出。
Pause and attempt this practice task before the solution.
暂停,先试着做这道练习,再看解答。
Music has a course record but no matching enrolment rows.
Music 有课程记录,但没有匹配的选课行。
Predict COUNT of e dot student ID, and COUNT star, after the LEFT JOIN.
预测 LEFT JOIN 之后 COUNT(e.student_id) 和 COUNT(*) 的结果。
Explain which gives its enrolment total.
解释哪一个给出它的选课人数。
For Music, the left join has one preserved course row with no matching student ID.
对于 Music,左连接保留了一行课程数据,没有匹配的学生 ID。
Count of the matched student ID ignores that empty value and gives zero.
对匹配学生 ID 的计数会忽略这个空值,结果是0。
Count star counts the preserved row itself and gives one.
COUNT(*) 计算的是保留下来的这一行本身,结果是1。
Neither count function is broken; they count different things.
两个计数函数都没有坏;它们计算的是不同的东西。
The mistake is labelling a joined-row count as an enrolment count.
错误在于把连接后的行数当作选课人数。
In the exercise, deliberately replacing the expression reveals this error.
在练习中,故意替换这个表达式就能暴露这个错误。
It is useful to test an empty relationship because data containing only populated classes would hide the difference.
测试一个空的关系很有用,因为只包含有人选课的班级的数据会把这种差异藏起来。
The threshold checks a class total after grouping.
这个阈值在分组之后检查班级总数。
Minimum one keeps the three classes with enrolments and excludes Music.
最小值为1时,保留三个有人选课的班级,排除 Music。
Minimum three keeps class ten, because its count equals three.
最小值为3时,保留10号班级,因为它的计数等于3。
The greater-than-or-equal operator includes equality; changing it to greater-than would answer a different question.
大于等于运算符包括相等的情况;改成大于就回答了另一个问题。
A where condition on course ID would select a class before grouping.
在课程 ID 上加 where 条件,会在分组之前选择班级。
It does not express a condition on the completed count.
它表达的不是关于计数完成后的条件。
Predict these small results before running the query, then compare them with the API output to confirm both the grouping and threshold logic.
运行查询之前,先预测这些小结果,然后和 API 的输出对照,确认分组和阈值的逻辑都对。
Adding the course counts gives five enrolments.
把各门课的计数加起来是5条选课记录。
That is not five different students.
这不是5个不同的学生。
Mei joins two classes and therefore contributes two pairs.
梅选了两个班级,所以她贡献了两个配对。
A report that labels this total as unique students would overcount people even though every SQL operation ran correctly.
一份报告如果把这个总数标为不同学生的人数,就会多算人数,尽管每一个 SQL 操作都运行正确。
Keep the distinction in your table labels, chart labels and interpretation.
在表格标签、图表标签和解读中都要保持这个区分。
The original question concerns class places, so counting enrolment pairs per class is appropriate.
原来的问题关乎班级的名额,所以按班级计算选课配对是合适的。
A separate question about the number of people participating would need a different calculation based on distinct student identities.
另一个关于有多少人参加的问题,需要根据不同的学生身份做另一种计算。
The server reads every min parameter, not just the first one without checking.
服务器读取每一个 min 参数,而不是不加检查地只取第一个。
If there is more than one, it rejects the request.
如果有不止一个,它就拒绝这个请求。
An absent parameter defaults to zero.
没有这个参数时默认为0。
The accepted text must represent one whole number from zero to ninety-nine, without a sign or a decimal point.
接受的文本必须表示一个0到99之间的整数,不带正负号,也没有小数点。
The browser control expresses the same intended rule for readers, but callers can bypass that control.
浏览器的控件为读者表达了同样的预期规则,但调用者可以绕过那个控件。
This is why a request such as min equals minus one is checked by the server itself.
这就是为什么像 min 等于 −1 这样的请求要由服务器自己来检查。
Input validation is part of the API contract, not just a page convenience.
输入验证是 API 约定的一部分,而不只是页面上的方便。
The prepared query contains a question-mark placeholder where the threshold value belongs.
准备好的查询在阈值应该出现的位置放了一个问号占位符。
The server supplies the accepted number to the statement's all method.
服务器把接受的数字提供给语句的 all 方法。
User input is not concatenated into the query text.
用户的输入不会被拼接到查询文本里。
This protects this value position from being interpreted as SQL syntax.
这保护了这个值的位置,不会被解释为 SQL 语法。
It is a specific protection: binding does not create access rules or make an unrelated route safe.
这是一种具体的保护:绑定不会创建访问规则,也不会让一个无关的路由变得安全。
It also does not let a value stand in for an SQL keyword or column name.
它也不能让一个值代替 SQL 关键字或列名。
For structural choices, use fixed server-owned alternatives rather than treating arbitrary input as query structure.
对于结构上的选择,使用服务器固定拥有的备选项,而不是把任意的输入当作查询结构。
Pause and attempt this practice task before the solution.
暂停,先试着做这道练习,再看解答。
Predict the status and meaning of a GET request for courses with min equal to 4, and of one with min equal to minus 1, using the original data.
用原始数据,预测对课程发出的 GET 请求在 min 等于 4 和 min 等于负 1 时的状态和含义。
Why do they require different responses?
为什么它们需要不同的响应?
An HTTP status describes the request outcome.
HTTP 状态描述请求的结果。
A valid threshold of four returns no matching courses and a success status of two hundred.
有效的阈值4没有匹配的课程,返回成功状态200。
A negative minimum violates the input rule and receives four hundred.
负的最小值违反了输入规则,得到400。
An unknown route receives four hundred and four.
未知的路由得到404。
A method other than GET receives four hundred and five because this teaching API is read-only.
GET 以外的方法得到405,因为这个教学 API 是只读的。
Do not use not found to mean an empty successful query.
不要用“未找到”来表示一个空的成功查询。
A browser also needs to distinguish these states, so that no courses found is not confused with a request that could not be completed.
浏览器也需要区分这些状态,这样“没有找到课程”就不会和“请求无法完成”混为一谈。
The query response provides course IDs, titles, capacities and enrolment totals.
查询响应提供课程 ID、标题、容量和选课总数。
It does not expose student names to the browser.
它不会把学生名字暴露给浏览器。
This is enough to answer the practical question and display places left.
这些足以回答实践问题并显示剩余名额。
Reducing returned fields also makes the API easier to explain.
减少返回的字段也让 API 更容易解释。
The fictional dataset contains no real student information, and it is only served on loopback.
这个虚构的数据集不包含真实的学生信息,而且只在本机回环地址上提供。
If this were adapted to real records or a public server, permission and access rules would become necessary.
如果把它改编用于真实记录或公开服务器,许可和访问规则就变得必要了。
An invented local example is not evidence that those requirements have been implemented.
一个编造的本地例子并不能证明这些要求已经实现。
Fetch completing does not mean that the server accepted the request.
fetch 完成并不意味着服务器接受了请求。
A server can return an error status and a JSON explanation through an otherwise completed network exchange.
服务器可以在一次本来已经完成的网络交换中,返回一个错误状态和一段 JSON 说明。
The browser therefore reads the object and checks response dot ok before using its course array.
所以浏览器读取对象,并在使用课程数组之前检查 response.ok。
If the response is unsuccessful, it displays an error instead of attempting to loop over missing result data.
如果响应不成功,它就显示一条错误信息,而不是尝试遍历不存在的结果数据。
Network failures and server errors both need a reader-visible outcome.
网络故障和服务器错误都需要一个读者看得见的结果。
The supplied complete page handles these cases and enables another attempt after the request finishes.
提供的完整页面处理了这些情况,并在请求结束后允许再试一次。
The page creates row and cell elements, then assigns each value to text content.
页面创建行和单元格元素,然后把每个值赋给 textContent。
This means a course title is displayed as text rather than treated as HTML markup.
这意味着课程标题会作为文本显示,而不会被当作 HTML 标记处理。
The values shown are the course ID, title, enrolment count and remaining places.
显示的值是课程 ID、标题、选课人数和剩余名额。
Remaining places is capacity minus the returned enrolment total.
剩余名额是容量减去返回的选课总数。
The complete dataset gives zero, one, one and three.
完整的数据集给出的是0、1、1和3。
This display calculation does not enforce capacity in the database.
这个显示上的计算并不在数据库中强制容量限制。
Keep the difference between showing a number and enforcing a booking rule clear when you adapt the example.
改编这个例子时,要清楚地区分“显示一个数字”和“执行一条选课规则”。
A failed request should not leave an old table looking like the new result.
失败的请求不应该让一张旧表格看起来像新结果。
The example clears its rows when a load starts, displays a loading message and disables its button temporarily.
这个例子在开始加载时清空各行,显示正在加载的信息,并暂时禁用按钮。
A populated response fills the table.
有数据的响应会填满表格。
An empty response says that no courses meet the minimum.
空的响应会说明没有课程达到最低人数。
A failure explains that the local server should be checked and permits a retry.
失败时会说明应当检查本地服务器,并允许重试。
We verified this by stopping only the example server while leaving the page open, requesting again and then restarting it.
我们这样验证过:只停掉示例服务器,保持页面打开,再次请求,然后重启服务器。
The retry restored the four original course results.
重试恢复了原来四门课程的结果。
Asynchronous requests do not always finish in the order they start.
异步请求完成的顺序不一定和开始的顺序相同。
The sample keeps a latest-request number.
示例保留了一个最新请求编号。
Each new request receives the next number, and a response may update the page only if its number is still current.
每个新请求得到下一个编号,只有当响应的编号仍然是当前编号时,它才可以更新页面。
The same condition controls final button re-enabling.
同一个条件也控制最后重新启用按钮。
This prevents an older response from replacing a newer result.
这防止了一个较旧的响应替换掉较新的结果。
It is a browser display rule, not a database transaction rule.
这是一条浏览器显示规则,而不是数据库事务规则。
It does not make simultaneous bookings safe, because no booking operation exists in this example.
它不能让同时选课变得安全,因为这个例子里根本没有选课操作。
Explain the boundary rather than giving one mechanism credit for another task.
要解释这条边界,而不是把一种机制的功劳记到另一项任务上。
For the decision about spare places, one course ID is the unit of analysis.
对于关于空位的决策,分析单位是一个课程 ID。
Before calculating, check that records contain the needed values, IDs refer to existing parents, enrolment pairs are not repeated and capacities are non-negative.
计算之前,检查记录包含所需的值,ID 指向存在的父记录,选课配对没有重复,容量不是负数。
A real report also needs a date because these totals change.
真实的报告还需要一个日期,因为这些总数会变化。
The database constraints catch some of these issues, but do not establish that every capacity is accurate or that every real enrolment was recorded.
数据库约束能发现其中一些问题,但不能证明每个容量都准确,或者每一条真实的选课都被记录了。
State the meaning of each row and total explicitly, so a reader does not confuse class counts, student counts and enrolment counts.
明确说明每一行和每个总数的含义,让读者不会把班级数、学生数和选课数搞混。
The original totals show spare places in classes twenty, thirty and forty.
原始的总数显示,20、30和40号班级还有空位。
Music has three spare places, while Coding twenty and Art thirty each have one.
Music 有3个空位,而 Coding 20 和 Art 30 各有1个。
A supported next action is to check whether those places are still available before offering them.
一个有依据的下一步行动,是在提供这些名额之前,先核实它们是否仍然可用。
Do not infer that Music is worse taught because fewer students enrolled.
不要因为选 Music 的学生少,就推断它教得不好。
Do not predict next term's demand from these four invented records.
不要根据这四条编造的记录预测下学期的需求。
A recommendation should be tied to the measured question and should name what still needs checking.
建议应当和所测量的问题挂钩,并说明还有什么需要核实。
This is how a descriptive SQL result can support a careful decision.
这就是描述性的 SQL 结果支持一个谨慎决策的方式。
A bar chart can compare capacity and enrolments for each individual course.
条形图可以比较每门课程的容量和选课人数。
Label the Coding classes with their IDs so readers do not merge them.
给两个 Coding 班级标上 ID,这样读者就不会把它们合并。
Show Music's zero instead of hiding the empty category.
把 Music 的0显示出来,而不是把空类别藏起来。
The report should explain its question, data checks, calculation or query, result and limits, followed by a sensible next action.
报告应当说明它的问题、数据检查、计算或查询、结果和局限,然后给出一个合理的下一步行动。
Another reader should be able to reproduce the summary.
另一位读者应当能重现这个汇总。
A clear picture makes the data easier to inspect, but it does not establish why the pattern occurred.
清楚的图让数据更容易检查,但它不能确立规律出现的原因。
Keep causal claims separate from what these records actually measure.
把因果说法和这些记录实际测量的东西分开。
Work through the practice tasks in your own copy.
在你自己的副本里完成实践任务。
Predict the results before running the code so that the run checks your reasoning.
运行代码之前先预测结果,这样运行就是在检验你的推理。
Minimum one returns ten, twenty and thirty; minimum three returns ten.
最小值为1时返回10、20和30;最小值为3时返回10。
Adding Drama with no enrolments should retain it at minimum zero with two spare places.
加入一个没人选的 Drama,在最小值为0时应当保留它,有2个空位。
Adding student two to class twenty raises that class total to two, so minimum two now returns both Coding classes.
把2号学生加入20号班级,会让那个班级的总数变成2,所以最小值为2时现在返回两个 Coding 班级。
A duplicate pair and a missing student reference should each be rejected for a different reason.
一个重复的配对和一个缺失学生的引用,都应当被拒绝,但原因各不相同。
Describe the relevant key rule rather than simply saying the database dislikes the input.
描述相关的键规则,而不是简单地说数据库不喜欢这个输入。
The explained answers connect the visible result to its cause in the code or data.
附解释的答案把看得见的结果和代码或数据中的原因联系起来。
The third table represents a many-to-many relationship.
第三张表表示多对多关系。
Title-only grouping merges different classes.
只按标题分组会合并不同的班级。
Count star includes the unmatched course row.
COUNT(*) 包括了没有匹配的课程行。
Foreign-key checking rejects a missing student; the paired primary key rejects the same enrolment twice.
外键检查拒绝不存在的学生;配对主键拒绝重复的同一条选课。
The server validates because callers can bypass a browser control.
服务器要做验证,因为调用者可以绕过浏览器的控件。
An empty successful query receives two hundred, while invalid input receives four hundred.
一个空的成功查询得到200,而无效的输入得到400。
End your project explanation with a recommendation about checking spare places and a limitation: invented current totals cannot predict actual future demand.
在项目说明的结尾,给出一条关于核实空位的建议和一个局限:编造的当前总数无法预测实际的未来需求。
Komentar
Belum ada komentar. Jadilah yang pertama bertanya atau berbagi sesuatu.