(TK) Coursera:Database Management Essentials Week 3 筆記

Data Warehousing for Business Intelligence 專項課程

Module 4

SQL Overview

SQL (Structured Query Language) is a computer language containing statements for database definition, control and manipulation.

SQL 前身為 IBM 系統 R 計畫的 SQUARE 語言,SQUARE 是相對較數學化的語言,在進行一些人為實驗後,IBM 將其重新命名為 SEQUEL,其後又更名為 SEQUEL 2。

SQL 可以在兩種情境中使用:

  • Standalone: User submits SQL statements (e.g. SQL developer)
  • Embedded: An executing program submits SQL statements DBMS sends results back

SQL 是一種完整的 Data Language,包含定義、操作和控制:

  • Definition: Create Objects
  • Control: Ensure proper usage of a database
  • Manipulation: Retrieve or change rows

SQL 是種一致性差的廣泛語言,意味其要在不同的 DBMS 間移植的能力差、成本高。這也使得在 DBMS 業界裡,創新成本更低,而轉換成本更高。

SELECT Statement Introduction

SELECT <column name>
SELECT <list of column expressions>
FROM <list of tables and join operations>
[WHERE <list of logical expressions for rows>]
[ORDER BY <list of sorting specifications>]