Databases and SELECT
Databases & SQL Lesson 1 2:07 English narration · English + 中文 subtitles burned in
Chapters
Transcript
A database stores information in tables, and a table is a grid — not unlike a spreadsheet.
数据库把信息存放在表里,而表是一个网格——和电子表格差不多。
Across, one row is one record: everything known about one student.
横着看,一行就是一条记录:关于一个学生的全部信息。
Down, one column is one field: the same piece of information for everybody.
竖着看,一列就是一个字段:所有人身上同一项信息。
Learn both pairs of words, because the exam uses record and field while the software says row and column.
两组词都要记住, 因为考卷说的是"记录"和"字段",而软件说的是"行"和"列"。
To read data you write a query, and the simplest one asks for everything.
要读取数据,你要写一条查询,而最简单的一条就是"把所有的都给我"。
SELECT chooses the columns, and the star means all of them.
SELECT 选择列,而星号表示"全部的列"。
FROM says which table to read.
FROM 指出要读哪一张表。
The database answers with the rows you asked for.
数据库用你要的那些行来回答。
Two keywords, one question, and you have already read a whole table.
两个关键字,一个问题,你就已经读完了一整张表。
Now the idea worth installing early, because everything later depends on it.
现在说那个值得尽早装进脑子里的概念,因为后面的一切都依赖它。
What comes back is itself a table — a result table.
回来的东西本身也是一张表——一张结果表。
Ask for one column and you get a table one column wide; ask for one row and you get a table one row tall.
要一列,你得到的是一张只有一列宽的表; 要一行,你得到的是一张只有一行高的表。
SQL is not printing values at you; it is turning one table into another.
SQL 不是在把值打印给你看;它是在把一张表变成另一张表。
That is why queries can be built up step by step.
这就是为什么查询可以一步一步地搭起来。
Three small things before you start.
开始之前有三件小事。
Keywords are usually written in capitals so they stand out from your table and column names — that is a habit, not a rule, and lower case runs perfectly well.
关键字通常写成大写,好让它们从你的表名和列名里跳出来—— 那是一种习惯,不是规则,写小写也完全能跑。
Every statement ends with a semicolon.
每一条语句都以分号结束。
And a cell with nothing in it shows as NULL, which means no value at all — not zero, and not an empty piece of text.
而一个什么都没有的单元格显示为 NULL,意思是"根本没有值"—— 不是 0,也不是一段空的文字。
Four things to take with you.
带走四点。
One: a table is rows, which are records, and columns (fields).
第一:表由行(记录)和列(字段)组成。
Two: SELECT chooses columns and FROM chooses the table.
第二:SELECT 选列,FROM 选表。
Three: a star means every column.
第三:星号表示所有的列。
Four: the answer is a table, and the query ends with a semicolon.
第四:答案是一张表,而查询以分号结束。
Now run the tasks below.
现在去做下面的题。