欢迎您光临自学哈网,只为分享网络知识教程,供大家学习参考!

SQL多种条件查询方法集合

作者 : 自学哈 本文共1108个字,预计阅读时间需要3分钟 2022-10-14 共156人阅读
也想出现在这里? 联系我们

查询值等于2.50的行

select column1,column2 from tables where column1=2.50;

查询字符等于‘fuses’的行

select column1,column2 from tables where column1='fuses';

查询值小于10的行

select column1,column2 from tables where column1<10;

查询值不等于1003的行

select column1,column2 from tables where column1<>1003;

查询值不等于1003的行

select column1,column2 from tables where column1!=1003;

查询值为5-10的行

select column1,column2 from tables where column1between 5 and 10;

查询某列为空的行

select column1,column2 from tables where column1 is null;

查询某列=1003且某列<=10的值

select column1,column2,c3 from tables where column1=1003 and column2<=10;

查询某列=1003或某列<=10的值

select column1,column2,c3 from tables where column1=1003 or column2<=10;

查询某列=1003或某列=1002且某列=10的值

select column1,column2,c3 from tables where column1=1003 or column2=1002 adn c3>=10;

查询某列=1003或某列=1002,某列>=10的值

select column1,column2,c3 from tables (where column1=1003 or column2=1002 )adn c3>=10;

查询多列从某表里的某列是10021003的所有行,按照某列排序

select column1,column2 from tables where column in (1002,1003) order by column;

查询多列从某表里的某列不是10021003所有行,按照某 列排序

select column1,column2 from tables where column not in (1002,1003) order by column;

本站声明:
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!

自学哈网 » SQL多种条件查询方法集合
也想出现在这里? 联系我们
© 2022 Theme by - 自学哈网 & WordPress Theme. All rights reserved 浙ICP备2022016594号