📌  相关文章
📜  mysql查询检查数据库表中是否存在记录 - SQL代码示例

📅  最后修改于: 2022-03-11 15:05:29.136000             🧑  作者: Mango

代码示例1
-- Returns 1 if exists, 0 else
SELECT EXISTS(SELECT 1 FROM my_table WHERE text LIKE '%something%');

SELECT 
    CASE 
        WHEN EXISTS(SELECT 1 FROM my_table WHERE text LIKE '%something%') = 1 THEN
            'It exists'
        ELSE 'Does not exist'
    END;