Chapterبەش 2 · Lectureوانە 2.2
From Files to Databasesلە فایلەوە بۆ بنکەدراوە
How records were kept before databases, what went wrong with separate files, how files are kept up to date, what a database is, where databases are used, and the fourteen advantages of a database, and its costs and risks.
پێش چۆن هەڵدەگیران، چی هەڵە بوو لە ، چۆن نوێ دەکرێنەوە، چییە، لە کوێ بەکاردێت و چواردە سوودەکەی و تێچوو و مەترسییەکانی.
What you will learnچی فێر دەبیت
- Describe a and a .
- Explain the disadvantages of a file-based system, with an example of each.
- Name the three jobs of .
- Define a and give examples of where databases are used.
- Match the advantages of a database to the file problems they solve.
- Name the costs and risks of the database approach and say why it is still worth it.
- و وەسف بکەیت.
- کەموکورتییەکانی ڕوون بکەیتەوە، بە نموونەیەک بۆ هەریەکەیان.
- سێ کارەکەی بژمێریت.
- پێناسەی بکەیت و نموونە بهێنیتەوە کە لە کوێ بەکاردێن.
- سوودەکانی بەو کێشانەی ببەستیتەوە کە چارەسەریان دەکەن.
- تێچوو و مەترسییەکانی ڕێگای ناو ببە و بڵێ بۆچی هێشتا شایەنی ئەوەیە.
Before computers: the manual systemپێش کۆمپیوتەر: سیستەمی دەستی
A way of keeping records by hand, on paper cards, in books and in folders, without a .
شێوازی هەڵگرتنی زانیارییە بە دەست، لەسەر کارتی کاغەزی، لە دەفتەر و لە دۆسیەدا، بەبێ .
The course defines it like this: a manual system is a bookkeeping system where records are maintained by hand, without using a computer system.
کۆرسەکە بەم شێوەیە پێناسەی دەکات: سیستەمێکی تۆمارکردنە کە تێیدا بە دەست ڕادەگیرێن، بەبێ بەکارهێنانی .
Think of a school office long ago. Every student had a paper card in a drawer, and the marks were written in a big register book. To find one student, somebody had to search the drawers by hand. If the book was lost or burnt, the marks were gone, because there was only one copy.
بیر لە نووسینگەی قوتابخانەیەک لە زۆر لەمەوبەر بکەرەوە. هەر قوتابییەک کارتێکی کاغەزیی لە چەکمەجەیەکدا هەبوو و نمرەکان لە دەفتەرێکی گەورەدا دەنووسران. بۆ دۆزینەوەی یەک قوتابی، دەبوو کەسێک بە دەست چەکمەجەکان بپشکنێت. ئەگەر دەفتەرەکە ون بووایە یان بسووتایە، نمرەکان نەدەمان، چونکە تەنها یەک کۆپی هەبوو.
A worked number. A class teacher marks each of 50 students present or absent on each of 26 school days: hand-written entries a month. Every new register means copying the 50 names again. A misspelt or skipped name makes two registers disagree, totals added by hand can be wrong, and the parents' phone numbers sit on separate papers in the office.
ژمارەیەکی کارپێکراو. مامۆستایەک بۆ هەر یەک لە 50 قوتابی لە هەر یەک لە 26 ڕۆژی خوێندن ئامادەبوون یان نەبوون دەنووسێت: نووسینی دەستی لە مانگێکدا. هەر دەفتەرێکی نوێ واتە نووسینەوەی 50 ناوەکە جارێکی تر. ناوێک کە بە هەڵە نووسرابێت یان لەبیر کرابێت دوو دەفتەر ناکۆک دەکات، کۆکردنەوەی دەستی دەکرێت هەڵە بێت و ژمارەی مۆبایلی دایک و باوکەکان لە سەر کاغەزی جیا لە نووسینگەدان.
The file-based approachسیستەمی پشتبەستوو بە فایل
File-based systems were an early attempt to computerise the manual filing system: the cards and books became files on a computer.
یەکەم هەوڵ بوون بۆ کۆمپیوتەریکردنی دۆسیەکان: کارت و دەفتەرەکان بوونە لەسەر .
A file-based system is a collection of application programs that perform services for the end users, such as printing a report or adding a new student. Each program defines and manages its own data. So the term file-based approach means that data is stored in one or more separate computer files, defined and managed by different application programs. A program that keeps its own data in its own file is what you write in Python file handling.
کۆمەڵێک کە خزمەت بە دەکەن، وەک چاپکردنی ڕاپۆرتێک یان زیادکردنی قوتابییەکی نوێ. هەر خۆی پێناسە دەکات و بەڕێوەی دەبات. کەواتە زاراوەی file-based approach واتە لە یەک یان چەند جیای هەڵدەگیرێت کە جیاواز پێناسەیان دەکەن و بەڕێوەیان دەبەن. کە خۆی لە خۆیدا هەڵدەگرێت ئەوەیە کە لە کارکردن لەگەڵ فایلەکان لە Pythonـدا دەینووسیت.
The file-based approachسیستەمی پشتبەستوو بە فایل
How an early file job ran: batch processingکارێکی کۆنی فایل چۆن ڕۆیشت: چارەسەرکردنی کۆمەڵەیی
Early files were kept on magnetic tape, which can only be read from start to end. So a job such as the weekly payroll ran as : a whole set of records processed as one unit, in one run, with nobody stepping in.
لەسەر هەڵدەگیران، کە تەنها لە سەرەتاوە تا کۆتایی دەخوێنرێتەوە. بۆیە کارێکی وەک مووچەی هەفتانە وەک دەکرا: کۆمەڵێکی تەواوی وەک یەک یەکە، لە یەک جار کارپێکردندا، بەبێ ئەوەی کەس دەست تێوەربدات.
The master file (master file) holds one record per employee, sorted by employee number.
سەرەکی (master file) بۆ هەر فەرمانبەرێک یەک هەڵدەگرێت، بە ڕیزی ژمارەی فەرمانبەر.
During the week, the changes (hours worked, new staff, pay rises) are collected in a transaction file, sorted in the same order.
لە ماوەی هەفتەکەدا گۆڕانکارییەکان (کاتژمێرەکانی کار، فەرمانبەری نوێ، زیادکردنی مووچە) لە گۆڕانکارییەکان (transaction file) کۆ دەکرێنەوە، بە هەمان ڕیز.
The payroll program reads the two files side by side, once, from start to end.
مووچە هەردوو شان بە شانی یەک، یەک جار، لە سەرەتاوە تا کۆتایی دەخوێنێتەوە.
It prints the payslips and a report and writes a new master file. Next week the new master is the old one ("father and son" files).
پسوولەی مووچە و ڕاپۆرتێک چاپ دەکات و سەرەکیی نوێ دەنووسێت. هەفتەی داهاتوو ئەو نوێیە دەبێتە کۆنەکە ( «باوک و کوڕ»).
Problems of files (1): access, repetition, disagreementکێشەکانی فایلەکان (١): دەستڕاگەیشتن، دووبارەبوونەوە، ناکۆکی
- Slow access time. Going straight to the data you want is very difficult. You need to know the whole hierarchy of folders to get to a specific file, and that takes a lot of time.
- Redundant data. The same data can be in two or more files, which takes up more disk space. This is called .
- Inconsistent data. Because of redundancy, the copies kept in different places may not match each other. This is called .
- کاتی دەستڕاگەیشتنی خاو. گەیشتنی ڕاستەوخۆ بەو دەتەوێت زۆر قورسە. پێویستە هەموو پلەبەندیی بزانیت بۆ ئەوەی بگەیتە دیاریکراو و ئەمە کاتێکی زۆر دەبات.
- دووبارە. هەمان دەکرێت لە دوو یان زیاتردا بێت، کە شوێنی زیاتری دیسک دەگرێت. پێی دەگوترێت .
- ناکۆک. بەهۆی دووبارەبوونەوەوە، ئەو کۆپییانەی لە شوێنی جیاواز هەڵگیراون لەوانەیە وەک یەک نەبن. پێی دەگوترێت .
The problems of keeping data in separate files: repeated and disagreeing data, hard access, broken rules, half-finished changes and two users at once.
کێشەکانی هەڵگرتنی لە جیاجیادا: و ، زەحمەتیی گەیشتن بە ، پێشێلکردنی ڕێساکان، گۆڕانکاریی نیوەچڵ و دوو لە یەک کاتدا.
Watch 0:49-9:53: a file-processing system, repeated and inconsistent data, hard access and isolated data.
لە 0:49 تا 9:53 سەیر بکە: ، و ، زەحمەتیی گەیشتن بە و پەرتەوازە.
Problems of files (2): recovery, sharing, correctness, accessکێشەکانی فایلەکان (٢): گەڕاندنەوە، هاوبەشی، دروستی، دەستڕاگەیشتن
- Difficult recovery of corrupt data. In a file processing system it is very hard to back up and bring back lost or damaged data.
- Problems with concurrent access. When several users work on the same data at the same time, errors (called anomalies) appear, because there is no concurrency control.
- Data integrity problems. Data should be consistent and correct. For that it must satisfy certain rules (constraints), for example “a mark is between 0 and 100”. In a file system every program must check these rules itself, so the rules are buried in program code and are hard to add or change.
- Atomicity of updates. A change should either happen completely or not at all. File systems cannot promise that.
- Unauthorized access. Anyone who gets access to the file can read or change the data. It is also hard to let a user see some of the data but not all of it.
- گەڕاندنەوەی قورسی تێکچوو. لە گرتنی و گەڕاندنەوەی ونبوو یان تێکچوو زۆر قورسە.
- کێشەی . کاتێک چەند لە هەمان کاتدا کار لەسەر هەمان دەکەن، هەڵە (پێیان دەگوترێت anomalies) دەردەکەون، چونکە نییە.
- کێشەی . دەبێت کۆک و دروست بێت. بۆ ئەمە دەبێت هەندێک ڕێسا () جێبەجێ بکات، بۆ نموونە «نمرە لە نێوان 0 و 100دایە». لە هەر دەبێت خۆی ئەم ڕێسایانە بپشکنێت، بۆیە ڕێساکان لەناو کۆدی شاردراونەتەوە و زیادکردن یان گۆڕینیان قورسە.
- گۆڕانکارییەکان. گۆڕانکارییەک دەبێت یان بە تەواوی ڕووبدات یان هەر ڕوونەدات. ناتوانن ئەمە مسۆگەر بکەن.
- دەستڕاگەیشتنی بێڕێگەپێدان. هەر کەسێک بگاتە ، دەتوانێت بخوێنێتەوە یان بیانگۆڕێت. هەروەها قورسە ڕێگە بە بدەیت هەندێک لە ببینێت و هەمووی نەبینێت.
Problems of files (2): recovery, sharing, correctness, accessکێشەکانی فایلەکان (٢): گەڕاندنەوە، هاوبەشی، دروستی، دەستڕاگەیشتن
A closer look: two people at once, and a change that stops half-wayلە نزیکەوە: دوو کەس لە یەک کاتدا و گۆڕانکارییەک کە لە نیوەدا دەوەستێت
Two people at once. Aram and Shilan share a family bank account with 100 in it. At the same moment, Aram takes 50 from a cash machine and Shilan takes 50 at the bank. Both programs read the balance, 100, and both write back 100 − 50 = 50. So 100 has been taken, but the file still says 50: Aram's change was simply overwritten. A file system has no to stop this.
دوو کەس لە یەک کاتدا. ئارام و شیلان هەژمارێکی بانکیی خێزانییان هەیە کە 100ی تێدایە. لە هەمان ساتدا ئارام 50 لە ئامێری ATM دەردەهێنێت و شیلانیش 50 لە بانکەکە. هەردوو باڵانسەکە دەخوێننەوە کە 100ـە و هەردووکیان 100 − 50 = 50 دەنووسنەوە. کەواتە 100 بردرا، بەڵام هێشتا 50 دەڵێت: گۆڕانکارییەکەی ئارام سڕایەوە. لە هیچ نییە کە ڕێگە لەمە بگرێت.
A change that stops half-way. Karwan sends 200,000 dinars to Hana. That is two steps: take the money from Karwan's account, then add it to Hana's. If the power fails between the two steps, the money has left Karwan but never reached Hana. The transfer must be atomic: both steps, or none. A file system cannot promise that.
گۆڕانکارییەک کە لە نیوەدا دەوەستێت. کاروان 200,000 دینار بۆ هانا دەنێرێت. ئەمە دوو هەنگاوە: پارەکە لە هەژمارەکەی کاروان دەربهێنە، پاشان بیخەرە سەر هەژمارەکەی هانا. ئەگەر لە نێوان ئەم دوو هەنگاوەدا کارەبا ببڕێت، پارەکە لە کاروان دەرچووە بەڵام هەرگیز نەگەیشتووەتە هانا. گواستنەوەکە دەبێت دابەشنەبوو بێت: یان هەردوو هەنگاو، یان هیچیان. ناتوانێت ئەمە مسۆگەر بکات.
A DBMS solves both problems with : it can make the second person wait, and it can undo a change that stopped half-way. You will learn how in Transactions and ACID, which explains the lost update and atomicity in full.
هەردوو کێشەکە بە چارەسەر دەکات: دەتوانێت کەسی دووەم ڕابگرێت تا چاوەڕێ بکات و دەتوانێت گۆڕانکارییەک هەڵبوەشێنێتەوە کە لە نیوەدا وەستاوە. چۆنیەتییەکەی لە مامەڵەکان و ACID فێر دەبیت، کە نوێکردنەوەی ونبوو و دابەشنەبوون بە تەواوی ڕوون دەکاتەوە.
The problems of keeping data in separate files: repeated and disagreeing data, hard access, broken rules, half-finished changes and two users at once.
کێشەکانی هەڵگرتنی لە جیاجیادا: و ، زەحمەتیی گەیشتن بە ، پێشێلکردنی ڕێساکان، گۆڕانکاریی نیوەچڵ و دوو لە یەک کاتدا.
Watch 12:32-19:54: a change that stops half-way (atomicity) and two users at the same time.
لە 12:32 تا 19:54 سەیر بکە: گۆڕانکارییەک کە لە نیوەی ڕێدا دەوەستێت () و دوو لە یەک کاتدا ().
Problems of files (2): recovery, sharing, correctness, accessکێشەکانی فایلەکان (٢): گەڕاندنەوە، هاوبەشی، دروستی، دەستڕاگەیشتن
Two more: programs tied to files, and sharing only partدوو کێشەی تر: بەرنامەکان بەستراو بە فایلەوە و هاوبەشکردنی تەنها بەشێک
Data dependence. Each program contains the exact layout of its files: which field comes first and how many characters it has. Make the name field longer or add a field, and every program that reads the file must be changed and tested again. A database removes this with data independence.
وابەستەیی (data dependence). هەر شێوەی ڕێکخستنی بە وردی لەناو خۆیدا هەیە: کام یەکەمە و چەند هەیە. ئەگەر ناو درێژتر بکەیت یان زیاد بکەیت، دەبێت هەموو ئەو دەخوێنێتەوە بگۆڕدرێت و دووبارە تاقی بکرێتەوە. ئەمە بە سەربەخۆیی دراوە لادەبات.
Controlled sharing is hard. In a school, the office and the parents should only read the attendance, and only the class teacher may change it. A file has no such rules: whoever can open it can change all of it. A DBMS gives each user only the rights they need.
هاوبەشکردنی کۆنترۆڵکراو قورسە. لە قوتابخانەیەکدا، نووسینگە و دایک و باوکەکان دەبێت تەنها ئامادەبوون بخوێننەوە و تەنها مامۆستای پۆلەکە بۆی هەیە بیگۆڕێت. ڕێسای لەو جۆرەی نییە: هەر کەسێک بتوانێت بیکاتەوە دەتوانێت هەمووی بگۆڕێت. تەنها ئەو مافانە دەدات بە هەر کە پێویستیەتی.
Maintaining a fileنوێکردنەوەی فایل
means the procedures that keep data current, in other words up to date. It has three jobs:
واتە ئەو ڕێکارانەی بە نوێیی دەهێڵنەوە، بە واتایەکی تر بە ڕۆژی دەکەنەوە. سێ کاری هەیە:
- Adding recordsزیادکردنی تۆمارەکان
A new student registers, so a new record is added to the students file.
قوتابییەکی نوێ ناونووس دەکات، بۆیە نوێ دەخرێتە سەر قوتابیان.
- Modifying recordsگۆڕینی تۆمارەکان
Dilan moves to Erbil, so the address in her record is changed.
دیلان دەچێتە هەولێر، بۆیە ناونیشانەکە لە دەگۆڕدرێت.
- Deleting recordsسڕینەوەی تۆمارەکان
The library removes a book it no longer has, so its record is deleted.
کتێبخانە کتێبێک لادەبات کە ئیتر نەیماوە، بۆیە دەسڕدرێتەوە.
In SQL these three jobs are the statements INSERT, UPDATE and DELETE. Together with SELECT (reading) they make . You write them in Databases and SQL: the four basic statements.
لە ئەم سێ کارە فەرمانەکانی INSERT، UPDATE و DELETEن. لەگەڵ SELECT (خوێندنەوە) پێکدەهێنن. لە بنکەدراوەکان و SQL: چوار فەرمانە بنەڕەتییەکە دەیاننووسیت.
What is a database?بنکەدراوە چییە؟
The need: we need to store a large amount of data in one place and fetch that data easily.
پێویستییەکە: پێویستمان بەوەیە بڕێکی زۆر لە یەک شوێندا هەڵبگرین و بە ئاسانی بیهێنینەوە.
An organized collection of data, stored so that a program can quickly find, add, change and delete it. Websites keep their users, products and messages in databases.
کۆمەڵەیەکی ڕێکخراوی دراوەیە کە بە شێوەیەک خەزن کراوە بەرنامەیەک بتوانێت بە خێرایی بیدۆزێتەوە، زیادی بکات، بیگۆڕێت و بیسڕێتەوە. تۆڕگەکان زانیاریی بەکارهێنەر و کاڵا و نامەکانیان تێدا خەزن دەکەن.
- Definition 1: A database is a collection of information or facts that is organised, so that it can easily be accessed, managed and updated.
- Definition 2: A database is an organised collection of data, also called structured data. It is stored in a computer system, it holds related data in a structured form, and it is managed through a .
- پێناسەی ١: کۆمەڵێک یان ڕاستیی ڕێکخراوە، بە شێوەیەک کە بە ئاسانی بگەیتێ، بەڕێوەی ببەیت و نوێی بکەیتەوە.
- پێناسەی ٢: کۆمەڵێکی ڕێکخراوی کە پێی دەگوترێت . لە سیستەمێکی کۆمپیوتەریدا هەڵدەگیرێت، پەیوەندیدار بە شێوەیەکی ڕێکخراو هەڵدەگرێت و لە ڕێگەی ـەوە بەڕێوە دەبرێت.
Textbooks give a stricter definition: a database is a persistent, logically coherent collection of meaningful data about one part of the real world. Persistent means it stays when the programs stop. That part of the world (a college, a clinic, a shop) is the mini-world, and the designers must understand it well. The word itself says it too: data + base, the foundation every program stands on.
کتێبەکان پێناسەیەکی وردتر دەدەن: کۆمەڵێکی هەمیشەیی و لۆجیکی یەکگرتووی واتادارە دەربارەی بەشێکی جیهانی ڕاستەقینە. هەمیشەیی واتە کاتێک دەوەستن، دەمێنێتەوە. ئەو بەشەی جیهان (کۆلێژێک، کلینیکێک، دوکانێک) پێی دەوترێت جیهانی بچووک (mini-world) و دیزاینەرەکان دەبێت باش تێی بگەن. خودی وشەکەش ئەمە دەڵێت: «بنکە» + «دراوە»، ئەو بناغەیەی هەموو لەسەری دەوەستێت.
A Kurdish (Sorani) introduction to what a database is and what data means, before building one in Access.
ناساندنێک بە کوردیی سۆرانی: چییە و واتای چییە، پێش ئەوەی لە Access دروست بکرێت.
Kurdish (Sorani), watch 0:44-4:23: what a database is.
بە کوردیی سۆرانی، لە 0:44 تا 4:23 سەیر بکە: چییە.
What is a database?بنکەدراوە چییە؟
One shared store for every programیەک کۆگای هاوبەش بۆ هەموو بەرنامەکان
Go back to the three programs of the college. With a database they no longer keep their own files. They all ask one , and the DBMS keeps one shared copy of the data.
بگەڕێوە بۆ سێ کۆلێژ. لەگەڵ ، ئیتر هەریەکەیان خۆی نییە. هەموویان داوا لە یەک دەکەن و یەک کۆپیی هاوبەشی ڕادەگرێت.
Why every website needs a database is explained from the programmer's side in Databases and SQL.
بۆچی هەموو ماڵپەڕێک پێویستی بە هەیە، لە لایەنی لە بنکەدراوەکان و SQL ڕوون کراوەتەوە.
What is a database?بنکەدراوە چییە؟
Worked example: two school files become three tablesنموونەی کارپێکراو: دوو فایلی قوتابخانە دەبنە سێ خشتە
A school office keeps a student file: roll number, name, date of birth, and the guardian's name, phone and address. The class teacher keeps an attendance file: date, roll number, name and present or absent. Here is how a database designer turns them into tables.
نووسینگەی قوتابخانەیەک قوتابیان هەیە: ژمارەی ڕیز، ناو، ڕێکەوتی لەدایکبوون و ناو، ژمارەی مۆبایل و ناونیشانی سەرپەرشتیار. مامۆستای پۆل ئامادەبوون هەیە: ڕێکەوت، ژمارەی ڕیز، ناو و ئامادە یان نائامادە. دیزاینەرێکی بەم شێوەیە دەیانکاتە :
The attendance file repeats each name every day. Drop it there: the roll number already leads to the name.
ئامادەبوون هەموو ڕۆژێک ناوی هەر قوتابییەک دووبارە دەکاتەوە. لەوێ لای ببە: ژمارەی ڕیز خۆی دەتگەیەنێتە ناوەکە.
Aram and his sister Lana have one guardian, so his details are stored twice. Give guardians a table of their own, one row each.
ئارام و خوشکەکەی لانا یەک سەرپەرشتیاریان هەیە، بۆیە زانیارییەکانی دوو جار خەزن کراون. تایبەت بدە بە سەرپەرشتیاران، بۆ هەریەکەیان یەک .
Two guardians can share a name, and phone numbers change, so neither can identify a guardian. Give each one a number,
GuardianID, and store it in the student table too.دوو سەرپەرشتیار دەکرێت هەمان ناویان هەبێت و ژمارەی مۆبایل دەگۆڕێت، بۆیە هیچیان ناتوانن سەرپەرشتیارێک بناسێنن. ژمارەیەک،
GuardianID، بدە بە هەریەکەیان و لە قوتابیانیشدا هەڵیبگرە.
| Table | Columns |
|---|---|
STUDENT | RollNo, Name, DateOfBirth, GuardianID |
GUARDIAN | GuardianID, Name, Phone, Address |
ATTENDANCE | Date, RollNo, Status |
The numbers that link the tables are keys (Database keys); the method behind these steps is normalization.
ئەو ژمارانەی بەیەکەوە دەبەستنەوە (کلیلەکانی بنکەدراوە)؛ ڕێگای پشت ئەم هەنگاوانە نۆرماڵکردنە.
Where databases are usedبنکەدراوەکان لە کوێ بەکاردێن
Databases touch every part of our lives. The course names five areas:
دەست لە هەموو بەشێکی ژیانمان دەدەن. کۆرسەکە ناوی پێنج بوار دەهێنێت:
| Areaبوار | What the database keeps چی هەڵدەگرێت |
|---|---|
| Bankingبانک | all transactions: deposits, withdrawals, transfersهەموو مامەڵەکان: دانان، دەرهێنان، گواستنەوەی پارە |
| Airlinesهێڵە ئاسمانییەکان | reservations and flight schedulesحیجزکردن و خشتەی گەشتەکان |
| Universitiesزانکۆکان | registration and gradesناونووسین و نمرەکان |
| Salesفرۆشتن | customers, products and purchasesکڕیاران، کاڵاکان و کڕینەکان |
| Human resourcesسەرچاوە مرۆییەکان | employee records and salaries فەرمانبەران و مووچەکان |
Textbooks add more: mobile phone companies (calls, messages, data use, prepaid balance and monthly bills), online shops (order tracking and recommendations), navigation apps (places, roads and bus routes) and factories (stock, orders and supply).
کتێبەکان زیاتریش دەژمێرن: کۆمپانیاکانی مۆبایل (پەیوەندی، نامە، بەکارهێنانی ئینتەرنێت، باڵانسی پێشەکی و پسوولەی مانگانە)، فرۆشگا ئۆنلاینەکان (بەدواداچوونی داواکاری و پێشنیار)، ڕێنیشاندەر (شوێن، ڕێگا و هێڵی پاس) و کارگەکان (کۆگا، داواکاری و دابینکردن).
- Card payments: before a payment is approved, the bank's database checks that the card is not reported lost or stolen, the limit and the balance, then takes the amount from the account.
- Supermarkets: scanning a finds the price, lowers the stock, and orders more automatically when the stock falls to the re-order point.
- Pharmacies: the patient's record lets the system warn when a new medicine does not go safely with one the patient already takes.
- پارەدان بە کارت: پێش ئەوەی پارەدانێک قبووڵ بکرێت، بانکەکە دەپشکنێت کە کارتەکە وەک ونبوو یان دزراو ڕاپۆرت نەکراوە، سنووری خەرجکردن و باڵانسەکە، پاشان بڕەکە لە هەژمارەکە دەبڕێت.
- سوپەرمارکێت: خوێندنەوەی نرخەکە دەدۆزێتەوە، ژمارەی کاڵا لە کۆگادا کەم دەکاتەوە و کاتێک ژمارەکە دادەبەزێتە خاڵی داواکردنەوە، خۆکارانە داوای زیاتر دەکات.
- دەرمانخانە: نەخۆشەکە ڕێگە بە سیستەمەکە دەدات ئاگادار بکاتەوە کاتێک دەرمانێکی نوێ لەگەڵ دەرمانێک کە نەخۆشەکە پێشتر دەیخوات بە سەلامەتی ناگونجێت.
Fourteen advantages of a databaseچواردە سوودی بنکەدراوە
Organisations moved away from files for fourteen reasons. Most of them answer one of the file problems you have just seen:
دامەزراوەکان لەبەر چواردە هۆ وازیان لە هێنا. زۆربەیان وەڵامی یەکێک لەو کێشانەی کە ئێستا بینیت:
| Advantageسوود | What it meansواتاکەی | File problem it answersکام کێشەی چارەسەر دەکات |
|---|---|---|
| 1 Control of data redundancy١ کۆنترۆڵی | Each fact is stored once (or in a few planned copies), not once per program.هەر ڕاستییەک یەک جار خەزن دەکرێت (یان لە چەند کۆپییەکی پلانبۆدانراودا)، نەک یەک جار بۆ هەر . | redundant data دووبارە |
| 2 Data consistency٢ | A change is made once, so everyone sees the same value.گۆڕانکاری یەک جار دەکرێت، بۆیە هەمووان هەمان دەبینن. | inconsistent data ناکۆک |
| 3 More information from the same amount of data٣ زیاتر لە هەمان بڕی | The data is integrated, so new questions can be answered by combining it. تێکەڵکراوە، بۆیە بە دەتوانیت وەڵامی پرسیاری نوێ بدەیتەوە. | difficulty in accessing dataقورسیی گەیشتن بە |
| 4 Sharing of data٤ هاوبەشکردنی | Many programs and people use the same data.چەندین و کەس هەمان بەکاردەهێنن. | data isolationدابڕانی |
| 5 Improved data integrity٥ باشتر | The DBMS checks the rules (constraints) for every program, for example “a mark is between 0 and 100”. ڕێساکان () بۆ هەموو دەپشکنێت، بۆ نموونە «نمرە لە نێوان 0 و 100دایە». | integrity problemsکێشەکانی |
| 6 Improved security٦ باشتر | Each user has an account and gets only the rights they need.هەر هەژمارێکی هەیە و تەنها ئەو مافانە وەردەگرێت کە پێویستیەتی. | unauthorized accessدەستڕاگەیشتنی بێڕێگەپێدان |
| 7 Enforcement of standards٧ سەپاندنی ستانداردەکان | Everyone follows the same names, formats and rules, for example dates written as YYYY-MM-DD.هەمووان پەیڕەوی هەمان ناو، فۆرمات و ڕێسا دەکەن، بۆ نموونە ڕێکەوت بە شێوەی YYYY-MM-DD دەنووسرێت. | every file in its own formatهەر بە فۆرماتی خۆی |
| 8 Economy of scale٨ ئابووریی قەبارە | One central system costs less than many separate ones.یەک سیستەمی ناوەندی کەمتر تێدەچێت لە چەندین سیستەمی جیا. | — |
| 9 Balance of conflicting requirements٩ هاوسەنگیی نێوان پێویستییە دژبەیەکەکان | The DBA designs for the whole organisation, so one department's needs do not harm another's.DBA بۆ هەموو دامەزراوەکە دیزاین دەکات، بۆیە پێویستیی بەشێک زیان بە بەشێکی تر ناگەیەنێت. | — |
| 10 Improved data accessibility and responsiveness١٠ گەیشتنی ئاسانتر و وەڵامی خێراتر | Users can ask new questions with a without waiting for a programmer. دەتوانن بە پرسیاری نوێ بکەن بەبێ چاوەڕوانیی . | slow access timeکاتی دەستڕاگەیشتنی خاو |
| 11 Increased productivity١١ بەرهەمهێنانی زیاتر | Programmers stop writing file-handling code again and again; the DBMS does that work. ئیتر کۆدی کارکردن لەگەڵ دووبارە نانووسنەوە؛ ئەو کارە دەکات. | — |
| 12 Improved maintenance١٢ باشتر | Programs do not depend on how the files are laid out (), so changes are easier. پشت بە شێوەی ڕێکخستنی نابەستن ()، بۆیە گۆڕانکاری ئاسانترە. | — |
| 13 Increased concurrency١٣ هاوکاتیی زیاتر | Many users can safely work on the data at the same time.چەندین دەتوانن بە سەلامەتی لە هەمان کاتدا کار لەسەر بکەن. | concurrent access |
| 14 Improved backup and recovery services١٤ خزمەتگوزاریی باشتری و | The DBMS backs up the data and brings it back to a correct state after a failure. لە دەگرێت و دوای تێکچوون دەیانگەڕێنێتەوە بۆ دۆخێکی دروست. | difficult recoveryگەڕاندنەوەی قورس |
The costs and risks of a databaseتێچوو و مەترسییەکانی بنکەدراوە
A database is not free of problems. Before an organisation moves from files, it should count these costs:
بێ کێشە نییە. پێش ئەوەی دامەزراوەیەک واز لە بهێنێت، دەبێت ئەم تێچووانە حیساب بکات:
- Money: a commercial DBMS licence, stronger computers (more memory and processing), and skilled staff: programmers who know the DBMS and a DBA. Free DBMSs such as MySQL, PostgreSQL and SQLite save the licence, not the staff.
- Conversion and training: the old files must be moved into the database, though their formats differ, and the old programs rewritten. Users must learn the new screens and queries.
- Some jobs run slower: a payroll file sorted exactly for its one program is faster than general database storage.
- One central point of failure: every program depends on the same system, so one crash stops them all, and wrong data written by one program reaches all the others.
- Harder recovery and running costs: after a crash the DBMS must work out which changes had finished, and many users changing data at once makes this harder. Backups cost time and storage every day.
- پارە: بازرگانی، بەهێزتر (بیرگە و توانای زیاتر) و کارمەندی شارەزا: کە دەناسن و DBAیەک. بێبەرانبەری وەک MySQL، PostgreSQL و SQLite پارەی دەگەڕێننەوە، نەک کارمەند.
- گواستنەوە و ڕاهێنان: دەبێت بگوازرێنەوە بۆ ، هەرچەندە فۆرماتەکانیان جیاوازن. دەبێت دووبارە بنووسرێنەوە. دەبێت شاشە و فێر ببن.
- هەندێک کار خاوتر دەبن: مووچە کە ڕێک بۆ تاقە ڕیزکراوە، لە خەزنکردنی گشتیی خێراترە.
- یەک خاڵی ناوەندیی تێکچوون: هەموو پشت بە هەمان سیستەم دەبەستێت، بۆیە یەک تێکچوون هەموویان دەوەستێنێت و هەڵە کە نووسیویەتی دەگاتە هەموو ئەوانی تر.
- گەڕاندنەوەی قورستر و تێچووی بەردەوام: دوای تێکچوون دەبێت بزانێت کام گۆڕانکاری تەواو بووبوو و گۆڕینی لەلایەن چەندین لە هەمان کاتدا ئەمە قورستر دەکات. هەموو ڕۆژێک کات و شوێنی خەزنکردن دەبات.
Quick checkپرسیاری خێرا
Give two disadvantages of a file-based system.دوو کەموکورتیی سیستەمی پشتبەستوو بە فایل بڵێ.
Redundant data and inconsistent data. Others: slow access, difficult recovery, no concurrency control, integrity problems, no atomic updates, unauthorized access.
دووبارە و ناکۆک. هی تریش: دەستڕاگەیشتنی خاو، گەڕاندنەوەی قورس، نەبوونی ، کێشەکانی ، نەبوونی و دەستڕاگەیشتنی بێڕێگەپێدان.
What are the three jobs of file maintenance?سێ کارەکەی نوێکردنەوەی فایل چین؟
Adding, modifying and deleting records.
زیادکردن، گۆڕین و سڕینەوەی .
In the definition of a database, why is “organised” the key word?لە پێناسەی بنکەدراوەدا، بۆچی «ڕێکخراو» وشە سەرەکییەکەیە؟
Because a pile of facts is not a database. Only facts arranged so that any one can be found, managed and updated quickly make a database.
چونکە کۆمەڵێک ڕاستیی ناڕێک نییە. تەنها ئەو ڕاستییانەی وا ڕێکخراون کە هەر یەکێکیان بە خێرایی بدۆزرێتەوە، بەڕێوە ببرێت و نوێ بکرێتەوە، پێکدەهێنن.
Name three advantages of a database and the file problem that each one answers.سێ سوودی بنکەدراوە بڵێ و ئەو کێشەیەی فایل کە هەریەکەیان چارەسەری دەکات.
For example: control of data redundancy answers redundant data; data consistency answers inconsistent data; improved security answers unauthorized access. Others: improved integrity (integrity problems), increased concurrency (concurrent access), better backup and recovery (difficult recovery).
بۆ نموونە: کۆنترۆڵی وەڵامی دووبارەیە؛ وەڵامی ناکۆکە؛ باشتر وەڵامی دەستڕاگەیشتنی بێڕێگەپێدانە. هی تریش: باشتر (کێشەکانی )، هاوکاتیی زیاتر ()، و باشتر (گەڕاندنەوەی قورس).
Name five disadvantages of the database approach, and explain one of them.پێنج کەموکورتیی ڕێگای بنکەدراوە بڵێ و یەکێکیان ڕوون بکەرەوە.
The cost of the DBMS, stronger hardware, skilled staff and training, converting old files and programs, some jobs running slower, one central point of failure, harder recovery. For example: if the one database server fails, every program that uses it stops.
تێچووی ، بەهێزتر، کارمەندی شارەزا و ڕاهێنان، گواستنەوەی و ، خاوبوونی هەندێک کار، یەک خاڵی ناوەندیی تێکچوون و قورستر. بۆ نموونە: ئەگەر تاقە تێکبچێت، هەموو ئەو بەکاری دەهێنێت دەوەستێت.
A small clinic in Halabja keeps patient details in three places: the reception has an Excel file, the doctor has a Word file, and the pharmacy has a notebook. Name three problems this causes and say how a database would solve each one.
نۆڕینگەیەکی بچووک لە هەڵەبجە زانیاریی نەخۆشەکان لە سێ شوێندا هەڵدەگرێت: پێشوازی Excelی هەیە، دکتۆرەکە Wordی هەیە و دەرمانخانەکە دەفتەرێک. سێ کێشە ناو ببە کە ئەمە دروستیان دەکات و بڵێ چۆن هەریەکەیان چارەسەر دەکات.
Hintئاماژە
Think of a patient whose phone number changes, of two people using the records at once, and of who can read the doctor's notes.
بیر لە نەخۆشێک بکەرەوە کە ژمارەی مۆبایلەکەی دەگۆڕێت، لە دوو کەس کە لە یەک کاتدا بەکاردەهێنن و لەوەی کێ دەتوانێت تێبینییەکانی دکتۆر بخوێنێتەوە.
Show answerوەڵامەکە پیشان بدە
- Redundant and inconsistent data: the patient's phone number is in three places; when it changes, one copy stays old. A database stores it once, so one change updates it for everyone.
- Unauthorized access: anyone at reception can open the doctor's file. A database gives each user only the rights they need: reception sees appointments, the doctor sees medical notes.
- Difficult access and recovery: to answer “which patients got this medicine last month?” someone must read a notebook page by page, and a lost notebook is gone for good. A database answers with one query and can be backed up and recovered.
- دووبارە و ناکۆک: ژمارەی مۆبایلی نەخۆش لە سێ شوێندایە؛ کاتێک دەگۆڕێت، یەک کۆپی کۆن دەمێنێتەوە. یەک جار خەزنی دەکات، بۆیە یەک گۆڕانکاری بۆ هەمووان نوێی دەکاتەوە.
- دەستڕاگەیشتنی بێڕێگەپێدان: هەر کەسێک لە پێشوازی دەتوانێت دکتۆرەکە بکاتەوە. تەنها ئەو مافانە دەدات بە هەر کە پێویستیەتی: پێشوازی کاتی سەردانەکان دەبینێت، دکتۆر تێبینییە پزیشکییەکان.
- گەیشتن و گەڕاندنەوەی قورس: بۆ وەڵامدانەوەی «کام نەخۆشانە مانگی ڕابردوو ئەم دەرمانەیان وەرگرت؟» دەبێت کەسێک دەفتەرەکە لاپەڕە بە لاپەڕە بخوێنێتەوە و دەفتەرێکی ونبوو بۆ هەمیشە ڕۆیشتووە. بە یەک وەڵام دەداتەوە و دەکرێت لێ بگیرێت و بگەڕێندرێتەوە.
Visit or phone a shop or pharmacy near you that still keeps its records in a notebook. Ask what goes wrong. List three problems and the database feature that would solve each one.
سەردانی دوکانێک یان دەرمانخانەیەک بکە لە نزیکی خۆت (یان تەلەفۆنی بۆ بکە) کە هێشتا لە دەفتەرێکدا ڕادەگرێت. بپرسە چی هەڵە دەچێت. سێ کێشە و ئەو تایبەتمەندییەی بنووسە کە هەریەکەیان چارەسەر دەکات.
Hintئاماژە
Typical answers are about searching, losing the notebook, wrong totals and who may see what.
وەڵامە باوەکان دەربارەی گەڕان، ونبوونی دەفتەر، کۆکردنەوەی هەڵە و ئەوەن کە کێ بۆی هەیە چی ببینێت.
Show answerوەڵامەکە پیشان بدە
- Finding one customer's total debt means reading many pages; a database answers with one query.
- A lost or wet notebook loses everything; a database can be backed up and recovered.
- Anyone at the counter can read or change the debts; a database gives the owner and the staff different rights.
- دۆزینەوەی کۆی قەرزی کڕیارێک واتە خوێندنەوەی چەندین لاپەڕە؛ بە یەک وەڵام دەداتەوە.
- دەفتەرێکی ونبوو یان تەڕبوو هەموو شتێک لەدەست دەدات؛ دەکرێت لە بگیرێت و بگەڕێندرێتەوە.
- هەر کەسێک لە پشت مێزەکە دەتوانێت قەرزەکان بخوێنێتەوە یان بیانگۆڕێت؛ مافی جیاواز دەدات بە خاوەن و کارمەندان.
The electricity office in Sulaymaniyah makes all monthly bills in one batch run, like the payroll job. Name the master file, the transaction file and what the run produces.
نووسینگەی کارەبای سلێمانی هەموو پسوولە مانگانەکان لە یەک جار کارپێکردنی دروست دەکات، وەک کاری مووچە. سەرەکی، گۆڕانکارییەکان و ئەوەی کارپێکردنەکە بەرهەمی دەهێنێت ناو ببە.
Hintئاماژە
Follow the four steps of the payroll example in the batch-processing screen.
چوار هەنگاوەکەی نموونەی مووچە لە شاشەی بگرە بەر.
Show answerوەڵامەکە پیشان بدە
- Master file: one record per customer, sorted by meter number: name, address, tariff, last month's reading and the amount still owed.
- Transaction file: this month's meter readings, sorted by the same meter number.
- The run works out the units used (new reading − old reading) and the price for each customer, and produces the printed bills, a report (total units, unpaid bills) and a new master file with the new readings and amounts owed.
- سەرەکی: بۆ هەر کڕیارێک یەک ، بە ڕیزی ژمارەی میتەر: ناو، ناونیشان، نرخی یەکە، خوێندنەوەی مانگی پێشوو و ئەو بڕەی هێشتا قەرزە.
- گۆڕانکارییەکان: خوێندنەوەی میتەرەکانی ئەم مانگە، بە هەمان ڕیزی ژمارەی میتەر.
- کارپێکردنەکە یەکە بەکارهاتووەکان (خوێندنەوەی نوێ − خوێندنەوەی کۆن) و نرخی هەر کڕیارێک حیساب دەکات و پسوولە چاپکراوەکان، ڕاپۆرتێک (کۆی یەکەکان، پسوولە نەدراوەکان) و سەرەکیی نوێ بە خوێندنەوە و قەرزە نوێیەکانەوە بەرهەم دەهێنێت.
Summaryپوختە
- A manual system keeps records by hand. A file-based system computerised it, but every program kept its own files.
- Early file jobs ran as batch processing: a sorted master file and a transaction file in, reports and a new master file out.
- File problems: slow access, redundant and inconsistent data, difficult recovery, concurrent access errors, integrity problems, no atomic updates, unauthorized access.
- File maintenance = adding, modifying and deleting records (
INSERT,UPDATE,DELETEin SQL). - A database is an organised collection of related data, managed by a DBMS. It usually holds structured data, but can also hold semi-structured and unstructured data.
- The fourteen advantages mostly answer the file problems: less redundancy, consistency, sharing, integrity, security, concurrency, backup and recovery, and more.
- A database also has costs and risks: licences, hardware, skilled staff, conversion, one central point of failure and harder recovery. For most organisations the advantages still win.
- بە دەست ڕادەگرێت. کۆمپیوتەریی کرد، بەڵام هەر خۆی هەبوو.
- کارە کۆنەکانی وەک دەکران: سەرەکیی ڕیزکراو و گۆڕانکارییەکان دەچوونە ژوورەوە، ڕاپۆرت و سەرەکیی نوێ دەهاتنە دەرەوە.
- کێشەکانی : دەستڕاگەیشتنی خاو، دووبارە و ناکۆک، گەڕاندنەوەی قورس، هەڵەکانی ، کێشەکانی ، نەبوونی و دەستڕاگەیشتنی بێڕێگەپێدان.
- = زیادکردن، گۆڕین و سڕینەوەی (
INSERT،UPDATEوDELETEلە ). - کۆمەڵێکی ڕێکخراوی پەیوەندیدارە کە بەڕێوەی دەبات. بە زۆری هەڵدەگرێت، بەڵام دەتوانێت و هەڵبگرێت.
- چواردە سوودەکە زۆربەیان وەڵامی کێشەکانی : دووبارەبوونەوەی کەمتر، کۆکی، هاوبەشی، دروستی، ، هاوکاتی، و و زیاتر.
- تێچوو و مەترسیشی هەیە: ، ، کارمەندی شارەزا، گواستنەوە، یەک خاڵی ناوەندیی تێکچوون و قورستر. بۆ زۆربەی دامەزراوەکان سوودەکان هێشتا زاڵن.
Next: the software that runs a database. Database management systems.
دواتر: ئەو بەڕێوە دەبات. سیستەمەکانی بەڕێوەبردنی بنکەدراوە.
Lesson complete!وانەکە تەواو بوو!
Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.
Key termsزاراوە سەرەکییەکان
Database Management Systemsسیستەمەکانی بەڕێوەبردنی بنکەدراوە
Related lecturesوانە پەیوەندیدارەکان
References and further readingسەرچاوەکان و خوێندنەوەی زیاتر
This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.