SQL 語句中where 條件後寫上1=1 功能
SQL 語句中where 條件後寫上1=1 功能
資料來源:https://mp.weixin.qq.com/s?__biz=MzA3MTg4NjY4Mw==&mid=2457309543&idx=2&sn=6528f2b4bbb4ba907043fe07824bc337&chksm=88a58353bfd20a45d2969a0d156970e05cb11f95064dab46d7c8cbf56ffbabd0197cafd91fa4&scene=126&sessionid=1597107917&key=bf49e72a192178bffd2222ca34c3f64c3f332e35c8713f97875211735cdb7b40eb03e03180936149a969cc1ec57c261990a13cdb9f85739cee6f272f5fc695f9f1ad408acf537db2f2042e2160edd136&ascene=1&uin=MjIwODk2NDgxNw%3D%3D&devicetype=Windows+10+x64&version=62090529&lang=zh_TW&exportkey=At0iultoeRZzw1szfLPlv2c%3D&pass_ticket=O51zswlQa4ei2HDLXAb8CFVIiPJWDGSo0gP8MeaPEUb3OFXHoIjJNAlEcY4hCyem
00.全表掃描時,提升速度
01.where 1=1 是為了避免where 關鍵字後面的第一個詞直接就是“and”而導致語法錯誤。
02.拷貝資料表(COPY TABLE)
CREATE TABLE table_name AS SELECT * FROM Source_table WHERE 1=1;
03.複製資料表結構(COPY TABLE STRUCT)
CREATE TABLE table_name AS SELECT * FROM Source_table WHERE 1!=1;
04.SQL注入攻擊(SQL INJECTION )
"id=-1 OR 1=1"