Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: [日] MICK

Rating No ratings yet

No description

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A patient, hands-on introduction to SQL and relational databases that takes you from installing PostgreSQL to writing window functions and joining tables. Best for complete beginners, self-taught learners who want systematic grounding, and instructors looking for a ready-made teaching text. 【Book Arc】 - **Opening (~0%–12%)**: Sets up the environment and mental model — what a database is, why a DBMS beats files and spreadsheets, installing PostgreSQL, creating a learning database, and the basic rules of writing SQL (constants, quoting, statement terminators). - **Early (~12%–32%)**: The querying core — SELECT/FROM, aliases, DISTINCT, WHERE, arithmetic and comparison operators, NULL handling, logical operators and three-valued logic, then aggregation (COUNT/SUM/AVG), GROUP BY, HAVING, and ORDER BY. - **Middle (~32%–52%)**: Data manipulation and complex queries — INSERT (including INSERT…SELECT), DELETE/TRUNCATE, UPDATE, then views, subqueries, scalar subqueries, and correlated subqueries with their scoping rules. - **Late (~52% onward)**: Functions, predicates, and CASE expressions, followed by joining multiple tables (inner, outer, cross, three-table joins) and advanced processing such as window functions and GROUPING operators (ROLLUP/CUBE/GROUPING SETS). - **Ending**: Connecting a database to an application, closing the loop from standalone SQL practice to real programmatic use. 【Key Takeaways】 - **A DBMS solves concrete problems files can't** (Opening): concurrent multi-user access, handling millions of rows, automation, and protection against accidents — the motivation for learning SQL at all. - **SELECT is the heart of SQL** (Early): master SELECT/FROM, WHERE, DISTINCT, and aliases and you've cleared the biggest hurdle; everything else builds on this. - **NULL is not zero and not empty** (Early): arithmetic with NULL yields NULL, comparisons with NULL don't return true/false, and you must use IS NULL / IS NOT NULL — a recurring source of beginner bugs. - **SQL logic is three-valued** (Early): conditions evaluate to TRUE, FALSE, or UNKNOWN, and truth tables govern how NOT/AND/OR combine them. - **Aggregation excludes NULL automatically** (Early): SUM/AVG/COUNT ignore NULLs, which is why "NULL in arithmetic" and "NULL in aggregation" behave differently. - **Clause order is fixed** (Early–Middle): SELECT → FROM → WHERE → GROUP BY → HAVING → ORDER BY; aliases defined in SELECT aren't visible to GROUP BY, and ORDER BY belongs at the end. - **Views store queries, not data** (Middle): a view is a saved SELECT that materializes a temporary table on read; it has limits (no ORDER BY in definition, restricted updatability). - **Subqueries come in flavors** (Middle): scalar subqueries fit anywhere a single value fits; correlated subqueries re-execute per row and require the correlation condition inside the subquery, not outside. 【Reading Tips】 - Deep-read Chapters 1–3 (setup, SELECT, aggregation); this is the foundation everything else assumes, and the exercises here pay off most. - Skim the PostgreSQL installation walkthrough if you already have a working database, but don't skip the "create a learning database" step — the book's examples depend on it. - Treat NULL and three-valued logic as a dedicated study topic; re-read those sections and test edge cases yourself rather than trusting intuition. - Work the end-of-chapter exercises before checking the appendix answers; the book is explicitly designed for hands-on practice. - When you reach views, subqueries, and joins, draw the execution order on paper — the book visualizes correlated subquery execution, and replicating that habit helps. 【Coverage Limits】 This guide is synthesized from stratified excerpts covering roughly the first half of the book plus table-of-contents glimpses of later chapters; detailed content on functions, joins, window functions, and application connectivity is only partially represented, so specifics there are inferred from headings rather than full text.
Excerpt 1
法。这里我们来创建一个学习用的数 据库,提前准备一下吧。 数据库的创建步骤如下所示。 1. 执行创建数据库的SQL语句 在命令提示符窗口,保持 PostgreSQL 连接的状态下,输入如下一行 SQL 语句,按下回车键。 请注意,数据库的名称只能使用小写字母。 CREATE DATABASE shop; 创建成功...
View in text
Excerpt 2
pe | sale_price T恤衫 | 衣服 | 1000 运动T恤 | 衣服 | 4000 菜刀 | 厨房用具 | 3000 高压锅 | 厨房用具 | 6800 ● 74 第2章 查询基础 KEYWORD 码清单2-36那样使用半角括号 ( )将OR运算符及其两侧的查询条件括起来。 代码清单2-36 通过使...
View in text
Excerpt 3
果进行排序 115 ● KEYWORD 应的编号,是不是没想到?列编号是指 SELECT子句中的列按照从左到 ●列编号 右的顺序进行排列时所对应的编号(1, 2, 3, …)。因此,代码清单 3-35 中 的两条 SELECT语句的含义是相同的。 代码清单3-35 ORDER BY子句中可以使用列的编号 -- 通...
View in text
Excerpt 4
办公用品 | 2 厨房用具 | 4 如上所示,子查询就是将用来定义视图的 SELECT语句直接用于 FROM子句当中。虽然“AS ProductSum”就是子查询的名称,但由 于该名称是一次性的,因此不会像视图那样保存在存储介质(硬盘)之中, 而是在 SELECT语句执行之后就消失了。 实际上,该 SELECT语...
View in text
Excerpt 5
erver PostgreSQL SELECT CAST('0001' AS INTEGER) AS int_col; MySQL SELECT CAST('0001' AS SIGNED INTEGER) AS int_col; Oracle SELECT CAST('0001' AS INTEGER) AS...
View in text
Excerpt 6
000A | 东京 | 0001 | T恤衫 000A | 东京 | 0002 | T恤衫 000A | 东京 | 0003 | T恤衫 000B | 名古屋 | 0002 | T恤衫 000B | 名古屋 | 0003 | T恤衫 000B | 名古屋 | 0004 | T恤衫 000B | 名古屋 | 000...
View in text
Excerpt 7
L 时的情况更加复杂一些,只有一个不合规则的 ROLLUP 能够使用。这里所说的“不合规则”指的是需要使用特定的语法。 -- MySQL专用 SELECT product_type, regist_date, SUM(sale_price) AS sum_price FROM Product GROUP BY p...
View in text
Excerpt 8
0001 | T恤衫 | 1000 | 1000 ←(1000)的最大值 0002 | 打孔器 | 500 | 1000 ←(1000, 500)的最大值 0003 | 运动T恤 | 4000 | 4000 ←(1000, 500, 4000)的最大值 0004 | 菜刀 | 3000 | 4000 ←(1000...
View in text
Tags
AI categories
DatabaseSQLProgramming Language
ISBN: 7115455023
Publish Year: 2017
Language: English
Pages: 341
File Format: PDF
File Size: 22.1 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…