CREATE VIEW NewPC3 AS
SELECT Component.price,
Mainboard.name as mainboard,
CPU.name as cpu,
GPU.name as gpu,
RAM.name as ram,
Computercase.name as computercase
FROM Mainboard,
cpu,
gpu,
ram,
computercase
NATURAL JOIN Component
WHERE mainboard.cpusocket = cpu.socket
AND mainboard.formfactor = computercase.formfactor;
所有表中的如果表主板中的cpusocket与cpu表中的套接字不匹配,则不应创建元组,而对于mainboard中的formfactor和计算机包中的formfactor,则不应该创建元组
testdata和预期结果:http://imgur.com/bi4m9b1