我创建了三个表
E:\Soft\lua\5.1\lua.exe: error loading module 'luamidi' from file 'E:\Code\Lua\FakeMagic\testingarea\test\libs\luamidi.dll':
E:\Code\Lua\FakeMagic\testingarea\test\libs\luamidi.dll:1: '=' expected near 'Р'
stack traceback:
[C]: ?
[C]: in function 'require'
E:\Code\Lua\FakeMagic\testingarea\test\midi.lua:2: in main chunk
[C]: ?
我正在寻找的答案是:
CREATE TABLE guest(
name varchar(100),
ranking int,
PRIMARY KEY (name)
);
CREATE TABLE room(
roomname varchar(100),
wallcolor varchar(100),
rating int,
PRIMARY KEY(roomnane)
);
CREATE TABLE reservation(
name varchar(100),
roomname varchar(100),
day varchar(100),
moveinday int,
moveoutday int,
PRIMARY KEY(roomname, day, start, finish),
FOREIGN KEY(roomname) REFERENCES room(roomname),
FOREIGN KEY(name) REFERENCES guest(name)
);
我正在尝试制定2个查询
我试过了
{LakeView, Monday, John, 10, 14, Reggie, 9, 11}
我不知道如何做where子句并获得正确的输入。任何帮助表示赞赏。
编辑:
这将被插入预订
select rr.roomname, rr.day, rr.name, rr.start, rr.finish, rr.name, rr.start, rr.finish
from room r, guest g, reservation rr
join reservation r1 on room.roomname = r1.roomname
join reservation r2 on room.roomname = r2.roomname
答案 0 :(得分:0)
你可以试试这个:
SELECT r1.roomname, r1.day, r1.name, r1.moveinday, r1.moveoutday, r2.name, r2.moveinday, r2.moveoutday
FROM reservation r1
INNER JOIN reservation r2
WHERE r1.roomname = r2.roomname AND
r1.day = r2.day AND
(
r1.moveinday between r2.moveinday and r2.moveoutday OR
r1.moveoutday between r2.moveinday and r2.moveoutday
) AND r1.name <> r2.name