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

软考 系统架构设计师 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);
  • 笛卡尔积:joininner joincross join
select * from table1, table2;
  • 投影:选择必要字段,如idname
select id, name, address from table1;
  • 选择:where条件。
select * from table1 where id = 100;
  • 连接:自动去除重复列,且不可使用onusing

natural joinnatural left joinnatural right join

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

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

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

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


Today On History
Browsing Refresh