Базы данных
Реляционная алгебра
select distinct A1, A2, …, An from R
select A1, A2, …, An from R -- с повторениями
select * from R where Condition
select …, b as a, … from R
select * from R1 union select * from R2
select * from R1 union all select * from R2 -- с повторениями
select * from R1 intersect select * from R2
select * from R1 intersect all select * from R2 -- с повторениями
select * from R1 except all select * from R2
select * from R1 except select * from R2 -- с повторениями
select *, expr as A from R
select X, Function(A) as A from R group by X
select count(*) … -- подсчет всех
select count(distinct *) … -- подсчет различных
select count(q) … -- подсчет не null
… having condition -- фильтрация после агрегации
… order by attrs -- сортировка
select * from R1 cross join R2
select * from R1, R2
select * from R1 natural join R2
select * from R1 inner join R2 using (A)
select * from R1 inner join R2 on R1.A = R2.A
select * from R1 inner join R2 on θ
select * from R1 [full] outer join R2 on θ
select * from R1 left [join] R2 on θ
select * from R1 right [join] R2 on θ
select p.Name as Name, f.Birthday as FatherBirthday, m.Birthday as MotherBirthday from Persons p inner join Persons f on p.FatherId = f.Id inner join Persons m on p.MotherId = m.id
select p.Name as Name from (предыдущий запрос) where p.MotherBirthday = p.FatherBirthday
select p1.Name as Name1, p2.Name as Name2 from Persons p1 inner join Persons p2 on p1.MotherId = p2.MotherId and p1.FatherId = p2.FatherId and p1.Id < p2.Id
select p.Name as Name, f.Name as ParentName from Persons p inner join Persons f on p.FatherId = f.Id union select p.Name as Name, m.Name as ParentName from Persons p inner join Persons m on p.MotherId = m.Id
select [distinct] … as …, … as … -- ε, π и ρ from R1 A1 ххх join R2 A2 on … -- ⊗ … ххх join Rn An on … -- ⊗ where … -- σ