The Database Management System (DBMS)
แนะนำใหม่
17:15
ฐานข้อมูล & โมเดลเชิงสัมพันธ์
ก่อนมีฐานข้อมูล แต่ละโปรแกรมจะเก็บไฟล์แบนของตัวเอง — ไฟล์ละหนึ่งต่อโปรแกรม สมมติว่าเป็นร้านขายของ โปรแกรมขายของ โปรแกรมออกบิล และโปรแกรมจัดส่ง…
บรรยายภาษาอังกฤษ · สลับคำบรรยายภาษาอังกฤษและภาษาจีนได้
ในบทเรียนนี้
| English | ความหมาย |
|---|---|
| computer reservation system | A computer system that manages bookings for services such as flights. |
| shared file | A file that multiple users or programs can access and use. |
| DBMS/ˌdiː biː em ˈes/ | ระบบจัดการฐานข้อมูล |
| flat files/flæt faɪlz/ | Files storing records without the relational structure and linked-table management provided by a relational database system. |
| view/vjuː/ | วิว |
| redundancy/rɪˈdʌndənsi/ | Additional or repeated data, capacity or components beyond what is strictly necessary, sometimes provided for reliability. |
| inconsistency/ˌɪnkənˈsɪstənsi/ | A difference between stored copies of the same fact, so they cannot all be correct. |
| data independence | The ability to change data storage without changing the programs that use it. |
| backup/ˈbækʌp/ | การสำรองข้อมูล |
| Data management/ˈdeɪtə ˈmænɪdʒmənt/ | The DBMS controlling how the data is stored, organised, retrieved and updated, so that programs never touch the files directly. |
| data dictionary/ˈdeɪtə ˈdɪkʃənəri/ | พจนานุกรมข้อมูล |
| table/ˈteɪbl/ | A collection of data organised into rows and columns. |
| field/fiːld/ | A named component of a record, with its own value and type. |
| data type/ˈdeɪtə taɪp/ | A classification of values that determines their representation and permitted operations. |
| key/kiː/ | A value used to identify or look up an associated item, such as a key in a dictionary or database. |
| relationship/rɪˈleɪʃənʃɪp/ | A connection between data in different database tables. |
| constraint/kənˈstreɪnt/ | A rule that limits what data can be stored in a database. |
| record/ˈrekɔːd/ | A stored collection of information about an item, person or event. |
| Data modelling/ˈdeɪtə ˈmɒdəlɪŋ/ | The process of defining data structures, including entities, attributes, keys and relationships. |
| logical schema/ˈlɒdʒɪkl ˈskiːmə/ | สคีมาเชิงตรรกะ |
| entities/ˈentɪtiz/ | Distinct objects or concepts represented in a data model, such as customers or products. |
| attributes/ˈætrɪbjuːts/ | A named property or characteristic associated with an object, element or record. |
| E-R diagram | A diagram showing entities and the relationships between them. |
| physical storage | The devices and methods used to store data as bytes. |
| indexed/ˈɪndekst/ | Describes data organised with a separate structure that helps the database find records faster. |
| Data integrity/ˈdeɪtə ɪnˈteɡrɪti/ | The quality of data being correct and consistent throughout the database. |
| Data security/ˈdeɪtə sɪˈkjʊərɪti/ | The DBMS controls who may see and change what. Access rights are given to individual users or to groups, table by table, as read-only , read and write , or no access. |
| primary keys | Fields or groups of fields that uniquely identify records in a table. |
| null/nʌl/ | A marker showing that a field has no value. |
| referential integrity/ˌrefəˈrenʃl ɪnˈteɡrɪti/ | A rule requiring every foreign-key value to match an existing primary key. |
| foreign key/ˈfɒrən kiː/ | A field or group of fields that refers to a candidate key in another or the same database table. |
| validation constraints | Rules that check whether data is allowed before it is stored. |
| range/reɪndʒ/ | The set of values between an allowed minimum and maximum. |
| Access rights/ˈækses raɪts/ | Permissions that control what a user or group can see or change. |
| read-only | Describes permission to view data without changing it. |
| read and write | Describes permission to view and change data. |
| passwords | Secret strings of characters used to check a user's identity. |
| authenticate | To check that a user is who they claim to be. |
| encrypted/enˈkrɪptɪd/ | Changed into a form that cannot be understood without the correct key. |
| log/lɒɡ/ | A record of events and actions on a computer system. |
| account/əˈkaʊnt/ | A user identity in a system, with its own login details and permissions. |
| administrator/ədˈmɪnɪstreɪtə/ | A person who manages a system and controls users' access rights. |
| transaction/trænˈsækʃn/ | ธุรกรรม |
| Concurrent access/kənˈkʌrənt ˈækses/ | The use of a database by multiple users at the same time. |
| Concurrency control/kənˈkʌrənsi kənˈtrəʊl/ | The management of simultaneous database access to keep data correct and consistent. |
| locks | Controls that temporarily prevent conflicting access to data during an operation. |
| virtual table | A table whose contents are produced from a query on stored data. |
| query/ˈkwɪərɪ/ | A request to retrieve or manipulate information, especially data in a database. |
| developer interface/dɪˈveləpə ˈɪntəfeɪs/ | อินเทอร์เฟซนักพัฒนา |
| programming interfaces | Methods that let programs communicate with and use another software system. |
| form builder | A tool for creating screens through which users enter or view data. |
| data entry | The process of putting data into a computer system. |
| report generator | A tool that presents database information in an organised document. |
| query builder | A tool that helps users create requests for database data. |
| SQL editor | A tool for writing and editing SQL commands. |
| data-dictionary editor | A tool for creating or changing descriptions of database structures and rules. |
| APIs | Defined ways for programs to communicate with and use a software system. |
| SQL/ˌes kjuː ˈel/ | Structured Query Language, used to define, query and manipulate data in relational databases. |
| query processor/ˈkwɪərɪ ˈprəʊsesə/ | ตัวประมวลผลคำถาม |
| result set | The collection of records returned when a query is run. |
| parses | Checks the structure of a query against the language's rules. |
คนสองคน ตักรถหนึ่ง
- ในปี 1960 American Airlines เปิดใช้งาน Sabre ซึ่งเป็นระบบจองตั๋วด้วยคอมพิวเตอร์ครั้งแรก พนักงานขายตั๋วในเมืองต่างๆ จำนวนมากสามารถขายที่นั่งบนเที่ยวบินเดียวกันในเวลาเดียวกันได้ และหน้าที่สำคัญที่สุดของระบบนี้คือการไม่มีการขายที่นั่งเดิมซ้ำเด็ดขาด
- ไฟล์.shared ทำสิ่งนี้ได้ไม่ได้: โปรแกรมสองโปรแกรมอ่านว่า "ที่นั่ง 14Cว่าง" แล้วทั้งคู่เขียนว่า "ขายแล้ว" ทำให้ผู้โดยสารสองคนมาถึงที่ประตูทางออกพร้อมกัน ต้องมีตัวกลางอยู่ระหว่างแต่ละโปรแกรมกับข้อมูลเพื่อทำหน้าที่ตัดสิน
- ตัวตัดสินนี้คือ DBMS คุณสมบัติทั้งหมดในบทเรียนนี้เป็นสิ่งที่ flat files ไม่สามารถทำได้: อธิบายโครงสร้างตัวเอง รักษาความสอดคล้องของมุมมองผู้ใช้ทุกคน บังคับใช้กฎกติกา ทนต่อการหยุดทำงานชั่วคราว และทำให้ทีมหนึ่งสร้างแอปพลิเคชันได้ในขณะที่อีกทีมตั้งคำถาม
- บทเรียนนี้ครอบคลุมคุณสมบัติที่หลักสูตรระบุไว้และเครื่องมือซอฟต์แวร์สองชนิดที่ต้องอธิบาย

DBMS คืออะไร
- Database management system (DBMS) คือซอฟต์แวร์ที่ใช้จัดการฐานข้อมูลแบบรวมศูนย์ ทุกโปรแกรมและทุกผู้ใช้เข้าถึงข้อมูลได้เพียงผ่าน DBMS เท่านั้น
- มันแก้ไขข้อจำกัดของไฟล์แต่ละไฟล์: ข้อมูลจริงแต่ละชิ้นมีเพียงสำเนาเดียว จึงไม่มี redundancy หรือ inconsistency; data independence ทำให้โปรแกรมไม่ผูกติดกับการจัดเก็บข้อมูล; ความสมบูรณ์และความปลอดภัยแบบรวมศูนย์ การสำรองข้อมูล และการเข้าถึงสำหรับผู้ใช้หลายคนพร้อมกัน
- หลักสูตรระบุคุณสมบัติ 5 ประการและเครื่องมือ 2 ชนิด จดจำแต่ละอย่างในฐานะสิ่งที่ DBMS กระทำ
ห้องปฏิบัติการบริการฐานข้อมูล
Watch how a DBMS turns a query into safe shared data access.
Match each DBMS service to what it does.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
A DBMS bundles these services so programs never touch the raw files directly.
การจัดการข้อมูลและ data dictionary
- Data management คือ DBMS ควบคุมวิธีการจัดเก็บ จัดระเบียบ ดึงข้อมูล และอัปเดตข้อมูล เพื่อให้โปรแกรมไม่สัมผัสไฟล์โดยตรง
- DBMS รักษาระบบ data dictionary: คำอธิบายของแต่ละตาราง ช่องข้อมูล ประเภทข้อมูล คีย์ Relationships และ constraints รวมถึงใครเข้าถึงอะไรได้บ้าง นี่คือข้อมูลเกี่ยวกับข้อมูล
- โปรแกรม query เข้า data dictionary แทนที่จะ hard-code โครงสร้างไว้ ทำให้เมื่อมีการเปลี่ยนแปลงตาราง โปรแกรมไม่พังลง DBMS ยังใช้ตรวจสอบเมื่อรับ record ใหม่
A data dictionary in a DBMS holds:
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
The data dictionary describes the database structure, so programs query it rather than hard-coding the layout.
Data modelling และ logical schema
- Data modelling คือการกำหนดโครงสร้างของข้อมูล: entities, attributes, keys และ relationships เหมือนใน E-R diagram
- ผลลัพธ์ที่ได้คือ logical schema: การออกแบบตรรกะโดยรวมของฐานข้อมูล ตาราง และ relationships ที่อธิบายโดยไม่ขึ้นอยู่กับวิธีจัดเก็บ byte บนไดรฟ์
- เนื่องจาก logical schema แยกจาก physical storage การจัดเก็บข้อมูลสามารถถูกปรับโครงสร้าง สร้าง index หรือย้ายตำแหน่งได้ โดยที่โปรแกรมยังมองเห็นตารางเดิมเหมือนเดิม

โปรแกรมเห็นเป็นตาราง; DBMS เห็นเป็นดิสก์
The logical schema of a database describes:
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
The logical design is separate from the physical storage, which is what lets the storage change without the programs noticing.
Data integrity และ data security
- Data integrity: DBMS รักษาความถูกต้องและความสอดคล้องของข้อมูลด้วยการบังคับใช้กฎกติการวมศูนย์: primary key ต้องเป็น unique และไม่ null, referential integrity ในทุก foreign key, ประเภทข้อมูล และ constraints แบบ validation เช่น ช่วงค่าหรือค่าจากรายการที่กำหนด
- Data security: DBMS ควบคุมว่าใครเข้าถึงและแก้ไขข้อมูลอะไรได้ Access rights ถูกมอบให้กับผู้ใช้รายบุคคลหรือกลุ่ม โดยแบ่งตามตาราง เป็น read-only, read and write หรือ no access; รหัสผ่านใช้ยืนยันตัวตนผู้ใช้; ข้อมูลที่จัดเก็บสามารถถูกเข้ารหัสได้
- Security also means backup procedures: regular copies of the database, with a log of changes since, so the data can be recovered after a failure.

Which are data-security features of a DBMS? Select ทั้งหมด that apply.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Who may access, and recovery after loss, are security. Normalisation is a design step against redundancy.
ตัวอย่างคำอธิบาย: DBMS รักษาความปลอดภัยของข้อมูลอย่างไร
- อธิบายว่า DBMS ให้ data security ได้อย่างไร [4]
- แต่ละผู้ใช้มีบัญชีและรหัสผ่าน ดังนั้นเฉพาะผู้ที่ได้รับอนุญาตเท่านั้นที่ล็อกอินได้ ผู้ดูแลระบบมอบ access rights ให้กับผู้ใช้หรือกลุ่มต่อตาราง: พนักงานขายอาจดูราคาได้แต่แก้ไขไม่ได้; ลูกค้าไม่สามารถเห็นตารางพนักงานได้เลย View สามารถแสดงเฉพาะ fields ที่ผู้ใช้ต้องการเท่านั้น
- The DBMS runs backup procedures: a regular copy of the database to a separate medium, with a log of transactions since the copy, so a failure or an attack loses no data.
- Security is about who may access; integrity is about the data being correct. Keep them apart when the question names one.
ผู้ใช้หลายคนพร้อมกัน
- Concurrent access: ผู้ใช้หลายคนทำงานกับฐานข้อมูลพร้อมกัน Concurrency control ใช้ locks ป้องกันไม่ให้ผู้ใช้สองคนอัปเดต record เดียวกันจนข้อมูลเสียหาย: ผู้ใช้คนที่สองจะรอจนกว่าผู้แรกจะเสร็จสิ้น
- Transaction คือกลุ่ม operations ที่ต้องสำเร็จทั้งหมดหรือล้มเหลวทั้งหมด ทำให้หากเกิด crash กลางคันการโอนเงิน จะไม่เกิดกรณีเงินหายจากทั้งสองบัญชี
- View เป็นตารางเสมือน ที่สร้างมาจาก query ซึ่งแสดงเฉพาะ slice ของข้อมูลที่ผู้ใช้ต้องการ

A database transaction is:
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Transactions are all-or-nothing, so the database is never left half-updated.
Concurrency control (locking) is needed so that:
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Locks stop two simultaneous updates from clashing and corrupting shared data.
A transaction is all-or-nothing: it either fully completes (commit) or fully undoes itself (rollback), so the database is never left half-updated.
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
This atomicity is why a bank transfer can never debit one account without crediting the other.
A virtual table (often a saved query) that shows a user only their relevant slice of the data is called a ______.
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
A view presents a tailored, often restricted, slice of the data without copying it.
Put the events of two users updating the same record under concurrency control in order.
ความยาก 3/5 · 200 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
The lock serialises the two updates so neither overwrites the other's change.
เครื่องมือซอฟต์แวร์
- อินเทอร์เฟซสำหรับนักพัฒนา คือชุดเครื่องมือและอินเทอร์เฟซการเขียนโปรแกรมสำหรับการสร้างแอปพลิเคชันบนฐานข้อมูล: เครื่องมือสร้างฟอร์มสำหรับการกรอกข้อมูล, เครื่องมือสร้างรายงาน, เครื่องมือสร้างคำถาม, เครื่องมือแก้ไข SQL, เครื่องมือแก้ไขพจนานุกรมข้อมูล, และ API ที่ให้โปรแกรมใน Python หรือ Java ส่งคำสั่ง SQL และรับผลลัพธ์กลับมาได้
- ตัวประมวลผลคำสั่ง (query processor) รับคำสั่งที่เขียนด้วย SQL มาตรวจสอบกับ data-dictionary, หาวิธีที่มีประสิทธิภาพที่สุดในการรันคำสั่ง, รันคำสั่งนั้น และส่งกลับชุดผลลัพธ์
- ผู้ใช้ที่พิมพ์คำสั่งและนักพัฒนาที่สร้างฟอร์มจองเป็นผู้ใช้ DBMS คนละส่วนกัน; คนแรกใช้ผ่านตัวประมวลผลคำสั่ง ส่วนอีกคนใช้ผ่านอินเทอร์เฟซนักพัฒนา

Match each DBMS component to its job.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Running queries, building applications, describing the structure, and the design itself: four different things the exam names separately.
ตัวอย่างคำตอบ: เครื่องมือสองชนิดที่ใช้ร่วมกัน
- ฐานข้อมูลของร้านค้าถูกใช้งานโดยผู้จัดการซึ่งต้องการยอดรวมยอดขาย และโดยนักพัฒนาที่กำลังเขียนแอปพลิเคชันควบคุมสต็อก อธิบายว่าตัวประมวลผลคำสั่งและอินเทอร์เฟซนักพัฒนาถูกใช้งานอย่างไร
- ผู้จัดการเขียนหรือสร้างคำสั่งเพื่อหายอดรวมยอดขาย; ตัวประมวลผลคำสั่ง จะ parse คำสั่ง, ใช้ data-dictionary ตรวจสอบว่ามีตารางและฟิลด์อยู่จริง, เลือกวิธีที่เร็วที่สุดในการรัน, รันคำสั่ง และส่งผลลัพธ์กลับมา
- นักพัฒนาใช้ อินเทอร์เฟซนักพัฒนา: เครื่องมือสร้างฟอร์มและรายงานเพื่อสร้างหน้าจอสต็อก และใช้ API เพื่อให้โค้ดของแอปพลิเคชันสามารถส่งคำสั่ง SQL ไปยัง DBMS และรับข้อมูลกลับคืนมา
- คะแนนละสองคะแนน: เครื่องมือคืออะไร และบุคคลนี้ใช้งานมันอย่างไร
คะแนนที่หลุดหายไป
- DBMS คือซอฟต์แวร์ ไม่ใช่ข้อมูล phrase "DBMS เก็บข้อมูลลูกค้า" เป็นคำผิด; มันทำหน้าที่จัดการข้อมูลเหล่านั้น
- data-dictionary เก็บข้อมูล เกี่ยวกับ ข้อมูล: โครงสร้าง, ประเภท, คีย์, สิทธิ์ ไม่ใช่บันทึกข้อมูลเอง
- logical schema คือการออกแบบที่ ไม่ขึ้นอยู่กับพื้นที่จัดเก็บทางกายภาพ ต้องพูด phrases นี้ให้ถูกต้อง
- ความปลอดภัย (Security) คือใครมีสิทธิ์เข้าถึง; ความสมบูรณ์ของข้อมูล (Integrity) คือข้อมูลที่ถูกต้อง การสำรองข้อมูล (Backup) อยู่ในหมวดความปลอดภัย
คุณเข้าใจแล้ว
- DBMS คือซอฟต์แวร์ที่ทุกโปรแกรมต้องผ่าน: มีข้อมูลจริงเพียงหนึ่งชุด, Data independence, กฎกลาง
- การจัดการข้อมูล พร้อม data-dictionary (ข้อมูลเกี่ยวกับข้อมูล) · การสร้างแบบจำลองข้อมูล เพื่อผลิต logical schema (การออกแบบที่ไม่ขึ้นอยู่กับพื้นที่จัดเก็บ) · ความสมบูรณ์ของข้อมูล (กฎที่ถูกบังคับใช้) · ความปลอดภัยของข้อมูล (สิทธิ์เข้าถึงของผู้ใช้และกลุ่ม, รหัสผ่าน, การเข้ารหัส, การสำรองข้อมูล)
- การควบคุมความพร้อมใช้งาน (concurrency control) ด้วย locks, Transactions ที่เป็น all-or-nothing, Views ที่แสดงส่วนข้อมูลของแต่ละผู้ใช้
- เครื่องมือ: อินเทอร์เฟซนักพัฒนา สำหรับสร้างแอปพลิเคชัน, ตัวประมวลผลคำสั่ง สำหรับรัน SQL
เกิดปัญหาอะไรขึ้น? เฉพาะทีมเว็บไซต์เท่านั้นที่เห็นข้อมูลนี้