資料表:每個資料庫的核心

SQL 關聯式資料庫入門

Timo Grossenbacher

Data Journalist

university_professors 資料表的重複資料

SELECT *
FROM university_professors
LIMIT 3;
SQL 關聯式資料庫入門
-[ RECORD 1 ]--------+-------------------------------------------------
firstname            | Karl
lastname             | Aberer
university           | ETH Lausanne
university_shortname | EPF
university_city      | Lausanne
function             | Chairman of L3S Advisory Board
organization         | L3S Advisory Board
organization_sector  | Education & research
-[ RECORD 2 ]--------+-------------------------------------------------
firstname            | Karl
lastname             | Aberer
university           | ETH Lausanne
university_shortname | EPF
university_city      | Lausanne
function             | Member Conseil of Zeno-Karl Schindler Foundation
organization         | Zeno-Karl Schindler Foundation
organization_sector  | Education & research
-[ RECORD 3 ]--------+-------------------------------------------------
firstname            | Karl
lastname             | Aberer
(truncated)
function             | Member of Conseil Fondation IDIAP
organization         | Fondation IDIAP
(truncated)
SQL 關聯式資料庫入門

SQL 關聯式資料庫入門

目前:資料庫中只有一種「實體類型」

SQL 關聯式資料庫入門

更好的資料庫模型:三種實體類型

舊版:

新版:

SQL 關聯式資料庫入門

更好的資料庫模型:四種實體類型

SQL 關聯式資料庫入門

用 CREATE TABLE 建立新資料表

CREATE TABLE table_name (
 column_a data_type,
 column_b data_type,
 column_c data_type
);
SQL 關聯式資料庫入門

用 CREATE TABLE 建立新資料表

CREATE TABLE weather (
 clouds text,
 temperature numeric,
 weather_station char(5)
);

SQL 關聯式資料庫入門

一起來練習吧!

SQL 關聯式資料庫入門

Preparing Video For Download...