百度SQL面试题 无效搜索
今天的题目是来自百度的SQL 面试题目
现有一份用户搜索日志,包含用户ID,时间,用户搜索内容。定义 无效搜索:如果用户下一次搜索内容中包含本次搜索内容,则认为本次搜索为无效搜索。请查询用户无效搜索记录
+---------+---------------------+------------------------+
| user_id | search_time | search_content |
+---------+---------------------+------------------------+
| 1 | 2022-01-01 10:00:00 | apple |
| 1 | 2022-01-01 11:30:00 | banana and apple |
| 1 | 2022-01-01 12:45:00 | fruit salad |
| 1 | 2022-01-01 15:00:00 | apple pie |
| 1 | 2022-01-01 16:20:00 | applesauce recipe |
| 2 | 2022-01-01 10:00:00 | cat food |
| 2 | 2022-01-01 11:30:00 | wet vs dry cat food |
| 2 | 2022-01-0