mysql的依耐庫 mysql學習問題解決

2021-10-19 19:43:58 字數 1015 閱讀 7384

1.字串轉時間格式函式: str_to_date('2017-10-19 16:47:00', '%y-%m-%d %h:%i:%s')

oracle的為to_date

2.specified twice問題

遇到這問題:網上查詢的解決方法

【錯誤內容】:error code: 1093. table '表名' is specified twice, both as a target for 'update' and as a separate source for data

【錯產生經過】:update t_test1 set col1= col1_value where val1 in(select val1 from t_test2 group by val1);

【解決辦法】:update t_test1 set col1= col1_value where val1 in(select * from (select val1 from t_test2 group by val1) as t);

注意:經測試delete時,也存在這種情況

3.模糊查詢測試中 特別測試的符號  % _ [

由於萬用字元的緣故,導致我們查詢特殊字元「%」、「_」、「[」的語句不能正常實現,而把特殊字元用「[ ]」括起便可正常查詢。

參考:4、mysql可以使用check約束,但check約束對資料驗證沒有任何作用

5、cannot delete or update a parent row: a foreign key constraint fails (`test`.`t_employee`, constraint `t_employee_ibfk_1` foreign key (`dept_no`) references `t_dept` (`dept_no`))

mysql設定了foreign key關聯,造成無法更新或刪除資料。可以通過設定foreign_key_checks變數來避免這種情況。

6、foreign key constraint is incorrectly formed 外來鍵約束格式不正確

ubuntu自行編譯mysql所需要的依賴包

apt get install libncurses5 dev apt get install g apt get install gcc apt get install make apt get install libpcre3 apt get install zlib1g apt get ins...

小白是學mysql好還是 小白學MySql

總所周知吧,這個資料庫有很多,最常用的免費資料庫那還要說到mysql,我本人呢也是對資料庫相關資料進行了一番查閱和學習,以下是我的一些片面的理解,主要分為四個部分 基礎 調優核心原理 架構與運維 1.基礎 基礎那就是基礎語法啊,以及表設計正規化 基礎語法 crud 在我看來基礎語法無非就是增刪改查,...

學mysql是學指令嗎 MySQL命令學習 二

13 where字句操作符 等於 不等於 不等於 大於 大於等於 between 在指定的兩個值之間 例如 找出學號是0007到0009之間的學生記錄 不包括0009 select from student info where stu id between 1001101620007 and 10...