ฝึกพูดภาษาอังกฤษด้วยเทคนิค Shadowing จากวิดีโอ: [Backend #1] Design DB schema and generate SQL code with dbdiagram.io

เลือกโหมดฝึก

แต่ละโหมดจะเปิดห้องฝึกแบบเต็มจอ

110 ประโยค
หากประโยคสั้นหรือยาวเกินไป กดที่ Edit เพื่อปรับแก้
1
Hello and welcome to TechSchool!
2
In this backend masterclass, we're going to learn everything about how to design,
3
develop, and deploy a complete backend system from scratch using PostgreSQL, Golang, and Docker.
4
The service that we're going to build is a simple bank.
5
It will provide APIs for the frontend to do following things.
6
First, create and manage bank accounts, which are composed of owner's name, balance, and currency.
7
Second, record all balance changes to each of the accounts.
8
So every time some money is added to or subtracted from the account, an account entry record will be created.
9
And third, perform a money transfer between 2 accounts.
10
This should happen within a transaction so that either both accounts' balance are updated successfully or none of them are.
11
In the first lecture, we will learn about database design.
12
I will show you how to design a SQL database schema using dbdiagram .io
13
Then save the schema as a PDF or PNG diagram to share it with your team.
14
And finally generate SQL code to create the schema in the target database engine of your choice,
15
such as PostgreSQL, MySQL, or SQL Server.
16
OK, let's start by going to dbdiagram .io And click go to app.
17
This is a sample db schema.
18
On the left, we define the table structure with some simple syntax.
19
Then its corresponding diagram will show up on the right.
20
We can use an export tool at the top to set this diagram as a PDF
21
or PNG file or generate SQL code for Postgres, MySQL, or SQL server.
22
Alright, now let's modify this schema for our database.
23
I'm gonna change the name of this diagram to simplebank.
24
OK, first we will have an account table.
25
We use a table keyword to declare a table.
26
And use a s keyword to set a short alias name for it.
27
Let's say we want each account to have a unique ID.
28
So I'm gonna use an autoincrement id field for it.
29
In this sample script, they use a increment keyword for that purpose.
30
But in Postgres, we could also use a type bigSerial.
31
It basically means a big autoincrementing integers, 8 byte or 64 bit.
32
We use a pk keyword to say that this field is the primary key of this table.
33
The next field is owner, which stores the name of the account owner.
34
So its type can be text or vachar.
35
Then a balance field to store the amount of available money of the account.
36
To be simple, I just use begin type here.
37
In reality, some currencies are not always integers, so you should consider using something like decimal type instead.
38
Now let's add one more field to store the name of the currency.
39
And finally a created at field to know when the account is created.
40
I think we should use a timestamp tz type here instead of just timestamp because it includes the timezone information as well.
41
And we want it to be automatically set by the database, So let's set a default value for it with a default keyword.
42
Postgres has a now function to get the current time.
43
We can simply put it inside a back tick pair to use it at the default value.
44
And that's it, the account table is done.
45
The next table is entries.
46
This table will record all changes to the account balance.
47
It also has an auto -increment ID column, which is a primary key.
48
And it has a for -range key, account ID of type BEGINED that references the ID column of the account table.
49
As you might know, this represents one -to -many relationship between account and entries table,
50
because one account can have many entries to change its balance.
51
Another field we will need is the amount of money that is added to the account balance in this entry.
52
It can be positive or negative, depending on whether the money is going into or out of the account.
53
And finally a created at field to record when the entry is created.
54
The last table is transfers.
55
It records all the money transfers between 2 accounts.
56
Let's say in this course we just care about internal transfers within simple bank.
57
So this table will have an auto increment ID primary key,
58
A foreign key from account ID And another foreign key to account ID Both reference the ID column of the account table.
59
Then the amount of money that moves from one account to the other.
60
But unlike amount in the entries table, this amount value must be positive.
61
And finally the created at field, just like in other tables.
62
OK, our db schema is almost done.
63
Now let's look at the rest of the example to see if there's anything we can add.
64
This is another way to declare the foreign key reference.
65
And we can also add some not now or unique constraint to some fields in all tables like this.
66
I don't think we have any fields that should be unique except for the primary keys, which already are.
67
So I'm gonna add not now constraint to the owner, balance, currency, and created at column of account table.
68
The amount and created at columns of entries table.
69
And similar for the transfers table.
70
We can also add some notes to the columns.
71
So let's add a note to the amount column of entries table, saying it can be negative or positive.
72
And another note to the amount column of transfers table, saying it must be positive.
73
We can even define a custom enum type for our column.
74
For example, we can define a currency enum with 2 possible values,
75
USD and EUR, and use it at the type of the account currency column.
76
However I prefer to use built -in type varchar here, and let the application code handle the value validation.
77
OK, the last thing we need to do is to add indexes to our tables.
78
For that, we will use the indexes keyword.
79
In the account table, we might want to search for account by owner name, so let's add owner to the list of the indexes.
80
In the entries table, we might want to list all entries of a specific account, so let's add account id to the index.
81
The transfers table is the most complex.
82
We might want to search for all transfers that going out of an account.
83
So from account id should be one index.
84
Similarly, we might want to look for all transfers that going into an account.
85
So to account id should be another index.
86
And finally, if we want to search for all transfers between 2 specific accounts,
87
then we need a composite index of both from account id and to account id.
88
And that's it, our schema definition is completed.
89
Now on the right, we can click auto -arrange to reorganize the db diagram that has been automatically generated for us.
90
It looks very nice, but let me rearrange it a bit so that we can see the relationship links more clearly.
91
OK, as you can see, there's a one -to -many links from account to entries table.
92
And there are 2 one -to -many links from account to transfers table.
93
Now let's try to generate PostgreSQL code by using the export tool at the top of the page.
94
The file is downloaded.
95
Let's open it.
96
Yeah, we have beautiful quote ready to be ran in PostgreSQL to create the database schema.
97
There are 3 create table queries to create the account, entries, and transfers table.
98
Then 3 alter table queries to add for range keys to the tables.
99
Then 5 create index queries to create all the indexes.
100
And finally 2 comment queries to add the comment to the amount columns.
101
Now let's try to export the diagram to PDF file.
102
Here we go, the diagram is successfully saved as a PDF file, ready to be shared with the team.
103
You could also export to other formats as well.
104
For example, this is a generated MySQL code.
105
Alright, the last thing we need to do is to save this design
106
and click share to get the link to share it with others
107
or use the embedded link to embed it into other pages.
108
And that's everything I want to share with you in this first lecture of the course.
109
I hope it's useful for you.
110
Thanks a lot for watching, and I'll catch you guys in the next one.

ดาวน์โหลดแอป

ทุกอย่างที่ต้องใช้เพื่อพูดได้คล่อง

AI ให้คะแนนการออกเสียงให้คะแนนทุกประโยค
ฝึก IPAเชี่ยวชาญทุกเสียง
คำศัพท์สร้างคลังคำของคุณ
เกมคำศัพท์เล่นไปเรียนไป
FOR YOU

วิดีโอแนะนำ

คำศัพท์และข้อสังเกตด้านการพูดสำหรับบทเรียนนี้

บทเรียนฝึกพูดนี้ใช้วิดีโอ “[Backend ] Design DB schema and generate SQL code with dbdiagram.io” เป็นสื่อ คำที่ถูกพูดซ้ำบ่อยที่สุด: account, table, transfer, column, add วิดีโอนี้มี 110 ประโยค และ 1408 คำ สำหรับฝึกพูดตาม ช่วงที่มีเสียงพูดยาว 9:57 ผู้พูดพูดด้วยความเร็วสม่ำเสมอ ประมาณ 142 คำต่อนาที เหมาะกับการฝึกพูดตาม 83% ของคำอยู่ใน 3,000 คำที่ใช้บ่อยที่สุดในภาษาอังกฤษ ส่วนที่เหลือควรดูไว้ก่อนเริ่มฝึก

คำศัพท์สำคัญในวิดีโอนี้

คำที่ควรเรียนรู้ 15 คำจากวิดีโอ พร้อมคำอ่านและความหมาย:

คำศัพท์คำอ่านความหมาย
column คำนาม/ˈkɒləm/เสา
diagram คำนาม/ˈdaɪ.ə.ɡɹæm/ไดอะแกรม, แผนผัง
currency คำนาม/ˈkʌɹ.ən.si/เงินตรา
database คำนาม/ˈdeɪtəˌbeɪs/ฐานข้อมูล
export คำนาม/ˈɛks.pɔɹt/การส่งออก
query คำนาม/ˈkwɪɹ.i/สอบถาม
server คำนาม/ˈsɝvɚ/เซิร์ฟเวอร์
lecture คำนาม/ˈlɛk.t͡ʃə/การบรรยาย, เล็กเชอร์
declare คำกริยา/dɪˈklɛɚ/ประกาศ
custom คำนาม/ˈkʌstəm/แบบแผน, ธรรมเนียม
depend คำกริยา/dɪˈpɛnd/พึ่ง
scratch คำกริยา/skɹæt͡ʃ/เกา
tick คำนาม/tɪk/เห็บ
syntax คำนาม/ˈsɪn.tæks/วากยสัมพันธ์
correspond คำกริยา/ˌkoɹəˈspɑnd/สอดคล้อง, สัมพันธ์

ไวยากรณ์ในวิดีโอนี้

โครงสร้างที่ผู้พูดใช้บ่อยที่สุด พร้อมคำพูดจริงจากวิดีโอ:

โครงสร้างในวิดีโอ
Passive voice be + กริยาช่อง 3 — เน้นสิ่งที่เกิดขึ้น ไม่ใช่ผู้กระทำare composed · is added · are updated
Relative clauses who / which + อนุประโยค — ข้อมูลเพิ่มเติมเกี่ยวกับคนหรือสิ่งของaccounts, which are · column, which is

การออกเสียงที่ควรระวัง

ผู้พูดใช้รูปย่อและรูปลดเสียง 10 ครั้ง เช่น gonna, I'm, we're ให้พูดแบบสั้นตามที่ได้ยิน

  • เสียง “sh” และ “zh”: transaction /tɹænˈzækʃən/, validation /ˌvæl.əˈdeɪ.ʃən/
  • คำยาว — ลงเสียงหนักให้ถูกพยางค์: successfully /səkˈsɛs.fə.li/, similarly /ˈsɪm.ə.lə.li/, validation /ˌvæl.əˈdeɪ.ʃən/

เสียงที่คนไทยมักออกเสียงยาก:

  • เสียงท้ายคำ — ออกเสียงให้ครบ ไม่เปลี่ยนเป็นตัวสะกดแบบไทย: database /ˈdeɪtəˌbeɪs/, columns /ˈkɑləmz/, scratch /skɹæt͡ʃ/, arrange /əˈɹeɪnd͡ʒ/, syntax /ˈsɪn.tæks/
  • /v/ — ไม่ใช่ /w/ ให้ฟันบนแตะริมฝีปากล่าง: server /ˈsɝvɚ/, validation /ˌvæl.əˈdeɪ.ʃən/, varchar /ˈvɑɹt͡ʃɑɹ/
  • /z/ — เสียงก้อง ไม่ใช่ /s/: columns /ˈkɑləmz/, transaction /tɹænˈzækʃən/, composite /kəmˈpɑzɪt/, compose /kəmˈpəʊz/

วิธีฝึกกับวิดีโอนี้

  1. ฟังวิดีโอให้จบหนึ่งรอบโดยยังไม่ต้องพูด แล้วจดคำที่ยังไม่รู้จัก
  2. พูดตามทีละประโยคด้วยความเร็วปกติ ทำซ้ำแต่ละประโยคจนจังหวะของคุณตรงกับผู้พูด
  3. อัดเสียงตัวเองแล้วเทียบกับต้นฉบับ โดยสังเกตคำอย่าง column, diagram, currency เป็นพิเศษ

เทคนิค Shadowing คืออะไร?

Shadowing เป็นเทคนิคการเรียนรู้ภาษาที่ได้รับการรับรองทางวิทยาศาสตร์ พัฒนาขึ้นสำหรับการฝึกนักแปลมืออาชีพ วิธีการนี้เรียบง่ายแต่ทรงพลัง: คุณฟังเสียงภาษาอังกฤษจากเจ้าของภาษาและพูดตามทันที — เหมือนเงาที่ตามผู้พูดด้วยช่วงเวลาห่าง 1-2 วินาที การวิจัยแสดงว่าเทคนิคนี้ปรับปรุงความแม่นยำในการออกเสียง ทำนองเสียง จังหวะ การเชื่อมเสียง การฟังเข้าใจ และความคล่องแคล่วในการพูดได้อย่างมีนัยสำคัญ

เทคนิค shadowing: อ่านคู่มือฉบับเต็มทีละขั้นตอน →