当前位置:网站首页 > 创业 > 正文

MySQL中带in关键字的集合查询

0 张子豪 张子豪 2025-10-12 09:11 1

带in关头字的调集查询

方式/步调

  1. 1

    只查询ID为2,4,6的信息

    select username from user where id in (2,4,6);

  2. 2

    除了不查询ID为2,4,6的信息外,其他的信息

    select username from user where not id in (2,4,6);

  3. 3

    查询sex中开首为w的信息

    select username,age from user where sex like 'w%';

  4. 4

    查询address中中心有u的信息,'_'的利用

    select username,age from user where address like '_u%';

    查询address中含有a的信息

    select username,age from user where address like '%a%';

  5. 5

    按春秋排序

    select*from user order by age asc;(升序)

    select*from user order by age desc;(j降序)

  6. 6

    limit的利用

    限制查询前5个信息

来源:百闻(微信/QQ号:9397569),转载请保留出处和链接!


本文链接:https://www.ibaiwen.com/web/240134.html

张子豪

张子豪

TA很懒,啥都没写...

@百闻娱乐 本站部分内容转自互联网,若有侵权等问题请及时与本站联系,我们将在第一时间删除处理。 | 粤ICP备2024343649号 | (地图