Learning SQL
暫譯: 學習 SQL

Alan Beaulieu

  • 出版商: O'Reilly
  • 出版日期: 2005-09-01
  • 售價: $1,420
  • 貴賓價: 9.5$1,349
  • 語言: 英文
  • 頁數: 312
  • 裝訂: Paperback
  • ISBN: 0596007272
  • ISBN-13: 9780596007270
  • 相關分類: SQL
  • 已過版

買這商品的人也買了...

相關主題

商品描述

Description:

SQL (Structured Query Language) is a standard programming language for generating, manipulating, and retrieving information from a relational database. If you're working with a relational database--whether you're writing applications, performing administrative tasks, or generating reports--you need to know how to interact with your data. Even if you are using a tool that generates SQL for you, such as a reporting tool, there may still be cases where you need to bypass the automatic generation feature and write your own SQL statements.


To help you attain this fundamental SQL knowledge, look to Learning SQL, an introductory guide to SQL, designed primarily for developers just cutting their teeth on the language.


Learning SQL moves you quickly through the basics and then on to some of the more commonly used advanced features. Among the topics discussed:

  • The history of the computerized database
  • SQL Data Statements--those used to create, manipulate, and retrieve data stored in your database; example statements include select, update, insert, and delete
  • SQL Schema Statements--those used to create database objects, such as tables, indexes, and constraints
  • How data sets can interact with queries
  • The importance of subqueries
  • Data conversion and manipulation via SQL's built-in functions
  • How conditional logic can be used in Data Statements


Best of all, Learning SQL talks to you in a real-world manner, discussing various platform differences that you're likely to encounter and offering a series of chapter exercises that walk you through the learning process. Whenever possible, the book sticks to the features included in the ANSI SQL standards. This means you'll be able to apply what you learn to any of several different databases; the book covers MySQL, Microsoft SQL Server, and Oracle Database, but the features and syntax should apply just as well (perhaps with some tweaking) to IBM DB2, Sybase Adaptive Server, and PostgreSQL.


Put the power and flexibility of SQL to work. With Learning SQL you can master this important skill and know that the SQL statements you write are indeed correct.

 

Table of Contents:

Preface

1. A Little Background

     Introduction to Databases

     What Is SQL?

     What Is MySQL?

     What's in Store

2. Creating and Populating a Database

     Creating a MySQL Database

     Using the mysql Command-Line Tool

     MySQL Data Types

     Table Creation

     Populating and Modifying Tables

     When Good Statements Go Bad

     The Bank Schema

3. Query Primer

     Query Mechanics

     Query Clauses

     The select Clause

     The from Clause

     The where Clause

     The group by and having Clauses

     The order by Clause

     Exercises

4. Filtering

     Condition Evaluation

     Building a Condition

     Condition Types

     NULL: That Four-Letter Word

     Exercises

5. Querying Multiple Tables

     What Is a Join?

     Joining Three or More Tables

     Self-Joins

     Equi-Joins Versus Non-Equi-Joins

     Join Conditions Versus Filter Conditions

     Exercises

6. Working with Sets

     Set Theory Primer

     Set Theory in Practice

     Set Operators

     Set Operation Rules

     Exercises

7. Data Generation, Conversion, and Manipulation

     Working with String Data

     Working with Numeric Data

     Working with Temporal Data

     Conversion Functions

     Exercises

8. Grouping and Aggregates

     Grouping Concepts

     Aggregate Functions

     Generating Groups

     Group Filter Conditions

     Exercises

9. Subqueries

     What Is a Subquery?

     Subquery Types

     Noncorrelated Subqueries

     Correlated Subqueries

     When to Use Subqueries

     Subquery Wrap-up

     Exercises

10. Joins Revisited

     Outer Joins

     Cross Joins

     Natural Joins

     Exercises

11. Conditional Logic

     What Is Conditional Logic?

     The Case Expression

     Case Expression Examples

     Exercises

12. Transactions

     Multiuser Databases

     What Is a Transaction?

13. Indexes and Constraints

     Indexes

     Constraints

A. ER Diagram for Example Database

B. MySQL Extensions to the SQL Language

C. Solutions to Exercises

D. Further Resources

Index

商品描述(中文翻譯)

**描述:**
SQL(結構化查詢語言)是一種標準的程式語言,用於生成、操作和檢索關聯數據庫中的信息。如果您正在使用關聯數據庫——無論是編寫應用程式、執行管理任務還是生成報告——您需要知道如何與數據互動。即使您使用的是自動生成 SQL 的工具,例如報告工具,仍然可能會有需要繞過自動生成功能並編寫自己的 SQL 語句的情況。

為了幫助您獲得這一基本的 SQL 知識,請參考《Learning SQL》,這是一本針對剛開始接觸這門語言的開發者的入門指南。

《Learning SQL》快速帶您了解基本概念,然後進入一些更常用的進階功能。討論的主題包括:
- 電腦化數據庫的歷史
- SQL 數據語句——用於創建、操作和檢索存儲在數據庫中的數據;示例語句包括 select、update、insert 和 delete
- SQL 架構語句——用於創建數據庫對象,如表、索引和約束
- 數據集如何與查詢互動
- 子查詢的重要性
- 通過 SQL 的內建函數進行數據轉換和操作
- 如何在數據語句中使用條件邏輯

最棒的是,《Learning SQL》以現實世界的方式與您對話,討論您可能遇到的各種平台差異,並提供一系列的章節練習,幫助您完成學習過程。書中盡可能遵循 ANSI SQL 標準中包含的功能。這意味著您可以將所學應用於多種不同的數據庫;本書涵蓋 MySQL、Microsoft SQL Server 和 Oracle Database,但這些功能和語法同樣適用於 IBM DB2、Sybase Adaptive Server 和 PostgreSQL(可能需要一些調整)。

將 SQL 的力量和靈活性付諸實踐。通過《Learning SQL》,您可以掌握這一重要技能,並確信您編寫的 SQL 語句確實是正確的。

**目錄:**
**前言**
**1. 一些背景**
- 數據庫介紹
- SQL 是什麼?
- MySQL 是什麼?
- 內容概覽
**2. 創建和填充數據庫**
- 創建 MySQL 數據庫
- 使用 mysql 命令行工具
- MySQL 數據類型
- 表的創建
- 填充和修改表
- 當良好的語句出錯
- 銀行架構
**3. 查詢入門**
- 查詢機制
- 查詢子句
- select 子句
- from 子句
- where 子句
- group by 和 having 子句
- order by 子句
- 練習
**4. 過濾**
- 條件評估
- 建立條件
- 條件類型
- NULL:那個四個字母的詞
- 練習
**5. 查詢多個表**
- 什麼是聯接?
- 聯接三個或更多表
- 自我聯接
- 等值聯接與非等值聯接
- 聯接條件與過濾條件
- 練習
**6. 與集合一起工作**
- 集合論入門
- 集合論在實踐中的應用
- 集合運算符
- 集合運算規則
- 練習
**7. 數據生成、轉換和操作**
- 處理字符串數據
- 處理數值數據
- 處理時間數據
- 轉換函數
- 練習
**8. 分組和聚合**
- 分組概念
- 聚合函數
- 生成分組
- 分組過濾條件
- 練習
**9. 子查詢**
- 什麼是子查詢?
- 子查詢類型
- 非相關子查詢
- 相關子查詢
- 何時使用子查詢
- 子查詢總結
- 練習
**10. 聯接重訪**
- 外部聯接
- 交叉聯接
- 自然聯接
- 練習
**11. 條件邏輯**
- 什麼是條件邏輯?
- Case 表達式
- Case 表達式示例
- 練習
**12. 交易**
- 多用戶數據庫
- 什麼是交易?
**13. 索引和約束**
- 索引
- 約束
**A. 示例數據庫的 ER 圖**
**B. MySQL 對 SQL 語言的擴展**
**C. 練習解答**
**D. 進一步資源**
**索引**