软考-系统架构设计师:关系代数

系统架构设计师 About 563 words

基本运算

  • 并
  • 交
  • 差
  • 笛卡尔积
  • 投影
  • 选择
  • 连接

用SQL表示

  • 并集:union。
select id from table1 union select id from table2;
  • 交集:inner join on。
select t1.id from table1 t1 inner join table2 t2 on t1.id = t2.id;
  • 并集:not in。
select id from table1 where id not in (select id form table2);
  • 笛卡尔积:join、inner join、cross join。
select * from table1, table2;
  • 投影:选择必要字段,如id、name。
select id, name, address from table1;
  • 选择:where条件。
select * from table1 where id = 100;
  • 连接:自动去除重复列,且不可使用on、using 。

natural join、natural left join、natural right join

select * from table1 natural join table2;
Views: 4,082 · Posted: 2019-09-08

———         Thanks for Reading         ———

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓
Prev Post
Next Post
Today In History
Browsing Refresh