"SQL"
Tags: "public", "project"
:PROPERTIES:
:ID: 5f12c4b1-8767-43ee-94cc-a1bd2cd5b23a
:mtime: 20231024033232
:ctime: 20231024033210
:END:
#+title: SQL
#+filetags: :public:project:
* SQL
In the context of databases, SQL is a programming language
based on [[id:d38dac96-015e-4386-873c-3a1e16911ef2][relational algebra]].
* [[id:d38dac96-015e-4386-873c-3a1e16911ef2][Relational Algebra]] vs [[id:5f12c4b1-8767-43ee-94cc-a1bd2cd5b23a][SQL]]
[[id:5f12c4b1-8767-43ee-94cc-a1bd2cd5b23a][SQL]] is based on Relational Algebra
| Relational Algebra | [[id:5f12c4b1-8767-43ee-94cc-a1bd2cd5b23a][SQL]] |
|--------------------+----------------------------|
| $\sigma_p(Q)$ | SELCT * FROM $Q$ WHERE $p$ |
| $\pi_x(Q)$ | SELECT $x$ from $Q$ |
| $\rho_M(Q)$ | SELECT AS $M$ from $Q$ |
| $Q_1 \cup Q_2$ | $Q_1$ UNION $Q_2$ |
| $Q_1 \cap Q_2$ | $Q_1$ INTERSECT $Q_2$ |
| $Q_1 - Q_2$ | $Q_1$ EXCEPT $Q_2$ |
| $Q_1 \times Q_2$ | $Q_1$ , $Q_2$ |
See Also
SQLSQLSQLrelational algebrarelational algebrarelational algebrarelational algebrarelational algebraSQLSQLSQLLeave your Feedback in the Comments Section