記錄學習中用到的sql語句

2022-08-11 02:03:19 字數 616 閱讀 9184

1、根據一張表更新另一張表的資料

update t_table t1

set a = t2.a,

b = t2.b

from t_table t2

where t1.name=t2.name

2、批量更新

mybatis批量更新

update mydata_table

when id=# then #

where id in

#

對應sql語句:

update mydata_table 

set status =

case

when id = # then #//此處應該是展開值

endwhere id in (...);

3、pgsql時間戳查詢
select extract(epoch from now())
4、sql高效查詢兩個表不同的資料
select * from b where (select count(1) from a where a.id = b.id) = 0

滲透中用到的sql語句 mysql篇

找到含有密碼欄位的表 select table name,column name from information schema.columns where column name like pwd or column name like passw 找含有特定內容的表名 select table ...

mysql中用到的一些sql語句

檢視資料庫預設配置資訊 show variables 檢視mysql資料庫編碼方式 show variables like character set database 檢視資料庫裡表的編碼方式,同時還能看到該錶使用的儲存引擎資訊 show create table char test 修改資料庫編...

不常用到的sql語句記錄

1 查詢觸發器是否存在 oracle select count as count from user triggers where trigger name upper triname sqlserver select count as count from sysobjects where nam...