rel-ops.txt
来自「icarnegie上数据库课程中的exercise1的答案」· 文本 代码 · 共 19 行
TXT
19 行
(
select Book.title, Book.price
from Book, Publisher
where Book.PublisherID = Publisher.PublisherID and Publisher.PublisherName = "武汉大学出版社";
)
union
(
select Book.title, BOOK.price
from Book, Publisher
where Book.PublisherID = Publisher.PublisherID and Publisher.PublisherName = "清华大学出版社";
);
说明:
这里使用了select和join的关系运算
要求查询武汉大学出版社和清华大学出版社出版的书的书名和价格
两张表以PublisherID为外码做笛卡尔积并从中选出PublisherName为武汉大学出版社和清华大学出版社的元组,
投影到属性title和price上。
再由union操作将投影的结果合并起来得到最终结果。
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?