数据库
首页 > 数据库> > SQL逻辑

SQL逻辑

作者:互联网

RDB (Relational Database)

关系型数据库源于relational model. Relational model? Relational model的内在逻辑是first-order (predicate) logic. (所有data表示为tuples, grouped into relations.) First-order logic? First-order Logic :Constants, Variables, Predicates, Functions, Quantifiers... Example: Only one student failed in Mathematics. In this question, the predicate is "failed(x, y),"... ∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y) → ¬failed (x, Mathematics)].

SQL作为声明式语言(Declarative language)

Declarative language... WHAT. 你要query的系统已经实现了具体怎么取 (query optimizer),声明式语言只须关注what results to get。 还有哪些常见的Declarative langages?

看起来声明式语言抽象层次更高(先有what再有how),所以学习这类语言,关键是准确理解具体query本身对应什么(what)功能、执行顺序如何。

SQL的运算

Logic and Databases Relational algebra基本操作:Union, Difference, Certesian Product, Projection, Selection, natural join. Query: The query evaluation problem, the query equivalence problem, the query containment problem. Relational algebra(数据库的传统运算) SQL_to_Relational_Algebra, SQL-Relational algebra计算器

SQL的执行顺序

Execution sequence of SQL FROM (JOIN) WHERE GROUP BY HAVING SELECT ORDER BY LIMIT

SQL Query优化

SQL Tutorial

   

标签:...,逻辑,Join,SQL,failed,query,Relational
来源: https://www.cnblogs.com/peij/p/14453733.html