sql中怎麼查詢名稱以,SQL中怎麼查詢名稱以 A

時間 2021-10-14 20:16:11

1樓:海天盛

1、建立測試表,如下圖。

create table test_col_1(id number, var varchar2(200));

create table test_col_2(id number, var varchar2(200));

2、插入測試資料,如下圖。

insert into test_col_1

select level*8, 'var'||level*8 from dual connect by level <= 20;

insert into test_col_2

select level, 'var'||level from dual connect by level <= 100;

3、查詢a表與b表關聯記錄,如下圖。

select *

from test_col_2 b

where exists (select 1 from test_col_1 a where b.id = a.id)

4、查詢a表全部資料及a、b有關聯的資料,如下圖。

select *

from test_col_1 a

union all

select *

from test_col_2 b

where exists (select 1 from test_col_1 a where b.id = a.id)

2樓:

以a開頭:select * from table where name like ‘a%'

以a結尾:select * from table where name like ‘%a'

包含a:select * from table where name like ‘%a%'

3樓:匿名使用者

以a開頭麼

用模糊查詢

select * from table where name like ‘a%'

4樓:

以 “ ‘a ” 開頭的用

select * from table_name where name like '''a%'

5樓:來自魚木寨給力的蔡文姬

題主出的題目有些模糊

假設題主的資料庫是產品資料庫

以a開頭:select product_name from product where product_name like 'a%'

以a結尾:select product_name from product where product_name like '%a'

包含a:select product_name from product where product_name like '%a%'

以上三種就是單個查詢關鍵字的方法望採納

VB查詢SQL報錯,VB中執行sql總是報錯,214721900,總評成績附近有錯,可是我在SQL查詢分析器裡執行了的

不嫌煩的修改方案 在原有 的基礎上 else do while not rsab1.eof l0.caption trim rsab1 tpb rsab1.movenext if rsab1.eof then exit do 每個rsab1.movenext後面都加這行 l1.caption tri...

sql查詢中如何將某列分成兩列,SQL中如何將兩列拼接

阿嘎灑 declare str varchar 50 set str 100.1203,200.1234 select substring str,1,patindex str 1 as 經度 reverse substring reverse str 1,patindex str 1 as 緯度 ...

在SQL中如何模糊查詢,請問如何在SQL語句中實現模糊查詢?

使用like 和 sql select from tablename where topicname like keyword 請問如何在sql語句中實現模糊查詢? 這是查詢tname中包含 你 的數 據select from teacher where tname like 你 這是查詢tname...