Auto commit

This commit is contained in:
smallkun 2025-03-18 19:41:55 +08:00
parent 8b030d5a28
commit df4fea3437

View File

@ -578,5 +578,50 @@ INSERT INTO travel (tid, time, position, money, aid, count) VALUES
(1, '5天', '八达岭', 3000, 101, 10), (1, '5天', '八达岭', 3000, 101, 10),
(2, '7天', '水长城', 5000, 101, 14), (2, '7天', '水长城', 5000, 101, 14),
(3, '8天', '水长城', 6000, 102, 11); (3, '8天', '水长城', 6000, 102, 11);
#4
SELECT a.*
FROM travel t, agency a
WHERE t.aid =a.id
GROUP BY a.id
HAVING COUNT(*) = (
SELECT COUNT(*)
FROM travel t, agency a
WHERE t.aid =a.id
GROUP BY a.id
ORDER BY COUNT(*) DESC
LIMIT 1
);
#5
SELECT t.*
FROM travel t
WHERE t.count = (
SELECT t.count
FROM travel t
ORDER BY t.count DESC
LIMIT 1
);
#6
SELECT *
FROM travel t
WHERE t.money < 5000;
#7
SELECT a.`name`
FROM travel t, agency a
WHERE t.aid =a.id AND t.money = (
SELECT t.money
FROM travel t, agency a
WHERE t.aid =a.id
ORDER BY t.money DESC
LIMIT 1
);
#8
SELECT SUM(t.time)
FROM travel t, agency a
WHERE t.aid =a.id AND a.`name` = '青年旅行社';
``` ```