SELECT NAME FROM salesPerson WHERE sales_id NOT IN (SELECT sales_id FROM company,orders3 WHERE company.`com_id` = orders3.`com_id` AND company.`name` = 'RED');
编写⼀个 SQL 查询,来删除 Person 表中所有重复的电⼦邮箱,重复的邮箱⾥只 保留 Id 最⼩ 的那个。
DELETE a FROM person3 a,person3 b WHERE a.email = b.email AND a.id > b.id;
SELECT ROUND(
(SELECT COUNT(*) c FROM (SELECT * FROM request_accepted GROUP BY requester_id,accepter_id) temp)
/(SELECT COUNT(*) f FROM (SELECT * FROM friend_request GROUP BY sender_id,send_to_id) temp),2)
AS result
SELECT
DISTINCT c1.seat_id
-- *
FROM
cinema2 c1
LEFT JOIN
cinema2 c2
ON
ABS(c1.seat_id - c2.seat_id) = 1
WHERE
c1.free = 1 AND c2.free = 1
ORDER BY c1.seat_id;
AddressId 是上表主键 编写⼀个 SQL 查询,满⾜条件:⽆论 person 是否有地址信息,都需要基于上述两 表提供 person 的以下信息: FirstName, LastName, City, StateSELECT FirstName,LastName,city,state FROM Address a ,person2 b WHERE a.`PersonId`=b.`PersonId`给定⼀个 salary 表,如下所示,有 m = 男性 和 f = ⼥性 的值。交换所..