The database program: tables and queries
A database management program holds the database and its parts, called objects. The two objects we need are tables and queries. A table stores records, shows them and lets you change them. A query is a request to the database: it can show only some of the fields of a table, or only the records that meet a condition, such as “the term with id 2”. The table stays as it is; the query only decides what you see. Our project uses MySQL, which is free and open source, and we talk to it in SQL. A query written in SQL for the Terms table looks almost like an English sentence: SELECT the fields you want FROM the table. Add WHERE and a condition, and only the matching records appear.
| Object | What it does | Example |
|---|---|---|
| table | stores, shows and changes records | the Terms table |
| query | shows chosen fields or chosen records | only the terms and their translations |
1SELECT Term, Trans FROM Terms;Term | Trans router | موجه cable | كابل browser | مستعرض
1SELECT Term FROM Terms WHERE id = 2;Term cable
Imagine the Terms table with three records and five fields: 1 router, 2 cable, 3 browser. Write on paper the result you expect from: a query that shows only id and Term; a query that shows all fields of the record whose id is 3.