日期:2025-07-13 13:57:46 人气:1

    A+
热门评论

sql语句中and和or怎么同时使用

1、创建测试表, create table test_andor(id number, value varchar2(200)); 2、插入样例数据, insert into test_andor values(1,1001); insert into test_andor values(2,1002); insert into test_andor values(3,1003); insert into test_andor values(4,1004); insert into test_andor values(5,1005); 3、查看表中所有记录 select * from test_andor, 4、编辑sql,涵盖and 和 or的条件,如,id为3或4,同时value=1003,注意or条件要用括号括起来。 select t.*, rowid from test_andor t where (id = 3 or id = 4) and value = 1004

阅读全文