1 / 15

第五章 認識 SQL 語言與 資料型別

第五章 認識 SQL 語言與 資料型別. 章節概覽. SQL 語言的興起與標準 SQL 語言的使用程式 –Query Analyzer SQL 語言的分類 SQL Server 所提供的資料型別. SQL 語言的興起與標準. SQL 語言的興起 SQL 這個名詞是由 IBM 發明 替連接關連式資料庫系統定義一個標準的規範 SQL 語言的特性 無需了解資料結構與演算法 加入一些流程控制的語言. 語言的使用程式 –Query Analyzer. 利用 Query Analyzer 進行指令查詢 利用 OSQL 進行命令提示字元查詢.

tracy
Download Presentation

第五章 認識 SQL 語言與 資料型別

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第五章 認識 SQL語言與資料型別

  2. 章節概覽 • SQL語言的興起與標準 • SQL語言的使用程式 –Query Analyzer • SQL語言的分類 • SQL Server所提供的資料型別

  3. SQL語言的興起與標準 • SQL語言的興起 • SQL這個名詞是由 IBM發明 • 替連接關連式資料庫系統定義一個標準的規範 • SQL語言的特性 • 無需了解資料結構與演算法 • 加入一些流程控制的語言

  4. 語言的使用程式 –Query Analyzer • 利用Query Analyzer進行指令查詢 • 利用OSQL進行命令提示字元查詢

  5. SQL語言的分類 • DDL(Data Definition Language) • DCL(Data Control Language) • DML(Data Manipulation Language)

  6. DDL (Data Definition Language) • 屬於資料定義語言 • 定義SQL Server中的所有物件 • 主要就是CREATE、ALTER與DROP三個指令所構成

  7. DCL(Data Control Language) • 屬於資料控制語言 • 利用DCL來控制哪些人具備對這個物件的權力 • 主要的語法有GRANT、DENY、REVOKE

  8. DML(Data Manipulation Language) • 屬於資料維護語言 • 利用DML指令將資料取出 • 主要的語法有SELECT、INSERT、UPDATE與DELETE

  9. SQL Server所提供的資料型別 • 數值類(int、bigint、smallint、tinyint…) • 日期類(datetime、smalldatetime) • 貨幣類(money、smallmoney) • 字元類(char、varchar、text…) • 二進位資料(binary、varbinary、image) • 特殊資料型別(bit、table、sql_variant、timestamp、uniqueidentifier、cursor、sysname)

  10. 數值類 • 整數(int、bigint、smallint、tinyint) • 精確小數(decimal、numeric) • 浮點數(float、real) • 每種資料型別都有適用時機

  11. 日期類 • DateTime • 長度為8Bytes • 直到9999年12月31日 • SmallDateTime • 長度為4Bytes • 到2076年6月6日

  12. 貨幣類 • Money • 長度為8Bytes • 為bigint加上小數點後三位 • SmallMoney • 長度為4Bytes • 為int加上小數點後三位

  13. 字元類 • char、nchar • 固定字串 • 會自動補空白 • varchar • 可變字串 • 隨輸入長度而改變大小 • text、ntext • 字串超過8000 Bytes時使用

  14. 二進位資料 • binary • 固定二進位資料 • varbinary • 可變二進位資料 • image • 二進位資料超過8000 Bytes時使用 • 可存放影像,Word資料

  15. 本章學習成果 • 何為 ANSI SQL • ANSI SQL指令可分為DML、DCL與DDL三種類型的指令 • SQL Server所提供的資料型別

More Related