跟讀練習: Understand SQL Transactions in 5 Minutes - 通過影片學習英語口語
選擇練習模式
每種模式都會開啟全屏練習室。
61 句
如果句子過短或過長,請點選 Edit 進行調整。
1
Ever lost data because something crashed halfway through a database update?
2
SQL transactions are here to protect you.
3
In this video, I'll explain them in simple terms, so you can keep your data safe and consistent, even when things go wrong.
4
A transaction is one of the key concepts in all database management systems.
5
Transactions allow multiple database operations to be grouped into one unit.
6
Within a single transaction, a sequence of data operations either occurs completely or not at all.
7
All intermediate states within a single transaction are not visible to other transactions, and if the transaction cannot be successfully completed for some reason,
8
none of the results will be saved in the database.
9
The easiest way to understand database transactions is through the classic example of banking transactions.
10
Imagine we are working with a bank's database.
11
We have a table that contains information about clients and their available balances.
12
For simplicity, this is a table consisting of two columns, the client's name, and the available balance.
13
Let's assume we want to transfer $100 from Andrew's account to John's account.
14
To do this, we need to perform the following operations.
15
Reduce Andrew balance by $100 with the update command, then increase John balance by these $100.
16
To perform such operation, we need to do two actions.
17
It is necessary that all these actions execute together or not execute at all.
18
A short failure isn't critical if Andrew's first attempt to transfer John's money fails, and both simply keep their original balances.
19
However, if one operation is completed, for example, Andrew's money is deducted but John's account doesn't receive it, this leads to serious issues.
20
In the real world, anything can happen between these two operations.
21
A brief network outage, an error at the banking application level, or something else.
22
We need a guarantee that if something interrupts the completion of this group of operations,
23
none of the results of the intermediate commands will be recorded in the database,
24
and we can get this guarantee if we combine these actions into a single transaction.
25
In PostgreSQL, a transaction consists of a series of SQL commands between the begin and commit statements.
26
If during a transaction we decide not to commit the changes, for example, if Andrew's balance turns negative,
27
we can use the rollback command instead of commit undoing all modifications.
28
It's also important to understand how transactions interact with each other.
29
By default, the transaction isolation level in PostgreSQL is Red Committed.
30
This means that transactions only see the data that other transactions have confirmed
31
and do not see changes made by these transactions that have not yet been confirmed.
32
Let's look at this example in practice.
33
I already have a table prepared with the necessary data.
34
Let's execute a select.
35
We see two balance records let's execute the transaction step -by -step.
36
First, let's perform a begin.
37
We started a transaction.
38
Everything that will happen here in this connection is now occurring within this transaction.
39
Let's execute the next line.
40
Execute select.
41
We see the intermediate result, but it is visible only within our current transaction.
42
Let's open a parallel connection to the database and perform a select from that connection, meaning outside the scope of the current transaction.
43
Open a new connection and execute the query.
44
We see that here Andrew's balance is still displayed as 600,
45
although in another open transaction we started an update and Andrew's balance has already decreased by 100.
46
Let's go back there and continue the transaction perform the next update
47
and see how the data in the table looks now
48
we see that john's balance increased by 100
49
but i repeat we see all this only within the current transaction if we switch to parallel connection
50
everything is still the same as it was before the transaction was executed let's go back and finally commit the transaction
51
Now the result is fully committed, and we will see it within Parallel Transactions.
52
Let's verify this.
53
Execute this query.
54
Now we see the final result.
55
Everything that happened within the transaction block wasn't visible in other database sessions until the transaction was committed,
56
and if the transaction hadn't been committed but was rolled back, then the result of the intermediate executions wouldn't be visible.
57
Thanks for watching.
58
If you want to dive deeper, my complete SQL course on Udemy is available with a special offer for YouTube viewers.
59
You'll get hands -on exercises, quizzes, and advanced tips we didn't cover here.
60
Links in the description.
61
And don't forget to subscribe for more tutorials.
FOR YOU
推薦影片
本課的詞彙與口語要點
這節口語課以影片“Understand SQL Transactions in 5 Minutes”為素材。 影片中反覆出現的詞有:transaction, balance, database, execute, operation。 這段影片共有 61 個句子、754 個單詞可供跟讀。 講話部分時長為 4:40。 說話人語速自然,每分鐘約 162 個詞,接近日常對話。 只有 79% 的單詞屬於英語最常用的 3,000 詞,詞彙難度較高。
影片中的重點詞彙
影片中 15 個值得學習的單詞,附發音和釋義:
| 單詞 | 發音 | 釋義 |
|---|---|---|
| transaction 名詞 | /tɹænˈzækʃən/ | 處理 /處理 |
| database 名詞 | /ˈdeɪtəˌbeɪs/ | 資料庫 /資料庫 |
| execute 動詞 | /ˈɛksɪˌkjuːt/ | 處決 /處決, 處死 /處死 |
| visible 形容詞 | /ˈvɪzɪb(ə)l/ | 看得見 /看得見, 可看見的 /可看見的 |
| intermediate 形容詞 | /ɪn.tə(ɹ)ˈmi.di.ət/ | 中間 /中間, 中級 /中級 |
| select 動詞 | /sɪˈlɛkt/ | 選 /選, 挑選 /挑選 |
| parallel 形容詞 | /ˈpæ.ɹəˌlɛl/ | 平行的 |
| occur 動詞 | /əˈkɜː/ | 發生 /發生 |
| guarantee 名詞 | /ˌɡæɹ.ənˈtiː/ | 保證 /保證 |
| confirm 動詞 | /kənˈfɝm/ | 證實 /證實, 確認 /確認 |
| consist 名詞 | /kənˈsɪst/ | 編組 /編組 |
| query 名詞 | /ˈkwɪɹ.i/ | 問題 /問題, 質問 /質問 |
| consistent 形容詞 | /kənˈsɪs.tənt/ | 一貫的 /一貫的 |
| sequence 名詞 | /ˈsiː.kwəns/ | 序列, 順序 /順序 |
| default 名詞 | /dɪˈfɔlt/ | 違約 /違約, 暴雷 |
影片中出現的短語動詞
| 單詞 | 釋義 |
|---|---|
| go back 動詞 | 回去, 返回 |
值得反覆跟讀的句子
影片中簡短而完整的句子,可以直接用在日常對話裡:
- Imagine we are working with a bank's database.
- Let's look at this example in practice.
- First, let's perform a begin.
- Let's execute the next line.
影片中的語法
說話人最常用的結構,並附上影片中的原話:
| 結構 | 影片中的用法 |
|---|---|
| 被動語態 be + 過去分詞 — 強調發生了什麼,而不是誰做的 | be grouped · cannot be successfully completed · will be saved |
| 現在完成時 have/has + 過去分詞 — 過去發生但與現在仍有關聯的事 | have confirmed · has already decreased |
需要注意的發音
說話人用了 9 次縮略和弱讀形式,例如 didn't, doesn't, don't。請按聽到的簡短形式來說。
- “sh” 和 “zh” 音: transaction /tɹænˈzækʃən/, execution /ˌɛk.sɪˈkjuː.ʃən/, completion /kəmˈpliː.ʃən/, isolation /ˌaɪsəˈleɪʃən/, modification /ˌmɑdɪfɪˈkeɪʃən/
- 長單詞——注意重音位置: intermediate /ɪn.tə(ɹ)ˈmi.di.ət/, successfully /səkˈsɛs.fə.li/, execution /ˌɛk.sɪˈkjuː.ʃən/, isolation /ˌaɪsəˈleɪʃən/, modification /ˌmɑdɪfɪˈkeɪʃən/
中文母語者容易讀錯的音:
- /v/ — 不要讀成 /w/,上齒輕觸下唇: visible /ˈvɪzɪb(ə)l/, dive /daɪv/, verify /ˈvɛɹɪfaɪ/, viewer /ˈvju.ɚ/
- 詞尾子音 — 要讀清楚,後面不要加母音: database /ˈdeɪtəˌbeɪs/, execute /ˈɛksɪˌkjuːt/, commit /kəˈmɪt/, intermediate /ɪn.tə(ɹ)ˈmi.di.ət/, select /sɪˈlɛkt/
- /r/ 和 /l/ 的區別: parallel /ˈpæ.ɹəˌlɛl/, tutorial /ˌtjuːˈtɔːɹɪəl/
如何用這段影片練習
- 先完整聽一遍影片,不要開口,記下不認識的單詞。
- 先用 0.75 倍速逐句跟讀,熟練之後再回到正常速度。
- 錄下自己的聲音並與原聲對比,特別注意 transaction, database, execute 這類單詞。
什麼是跟讀法?
跟讀法 (Shadowing) 是一種有科學依據的語言學習技巧,最初開發用於專業口譯員的培訓,並由多語言者Alexander Arguelles博士普及。這個方法簡單而強大:您在聽英語母語原聲的同時立即大聲重複——就像是一個延遲1-2秒緊跟說話者的影子。與被動聽力或語法練習不同,跟讀法強迫您的大腦和口腔肌肉同時處理並模模擬實的講話模式。研究表明它能顯著提高發音準確性,語調,節奏,連讀,聽力理解和口語流利度——使其成為雅思口語備考和真實英語交流最有效的方法之一。












