Mysql資料庫各類知識總結

2021-08-13 09:00:50 字數 1195 閱讀 2378

1、鏈結資料庫的命令---mysql-u root-p 回車,輸入密碼//在cmd上輸入自己的賬號密碼

2、檢視:show databases;

3、建立資料庫:create +database+資料庫名稱+;

4、刪除資料庫:drop +detabase+資料庫名稱

5、使用資料庫:use +資料庫名稱

6、檢視多張表:show tables

7、*代表所有

8、也可以檢視部分select 屬性,屬性 from 表名

9、檢視**內資料:select +*+from+**名稱

10、刪除**:drop

table +**名稱

11、修改**:update+table+**名稱+

12、建立表:create+table+表名+(屬性名 資料型別+,+屬性名 資料型別)

13、刪除**內一行資料:delete +from+表名(這樣會刪除所有)

14、加條件的:delete +from+表名+where+id=2(條件);

15、update+表名+set+屬性名=』新的名稱(修改以後的值)『,+屬性名=』新的屬性名『

update+表名+set+屬性名=』新的名稱(修改以後的值)『,+屬性名=』新的屬性名『+where +id=1(乙個屬性)

16、檢視**詳細結構:show

create

table + 表名

17、檢視**基本結構:desc+表名

18、修改表名 :語法:alter

table+表名+rename+新錶名

例子:alter

table test2 rename aaaaa

19、修改字段,修改屬性 :語法:alter

table +表名+change+屬性名+新的屬性名+新的資料型別

例子: alter

table test2 change code id int;

20、增加字段,增加屬性 :語法:alter

table +表名+add+屬性名+資料型別

例子:alter

table test2 add age int;

21、刪除字段 : 語法:alter

table +表名+drop+欄位名稱

例子:alter

table test2 drop age;

Mysql資料庫知識總結

事務4個特性 a 原子性 c 一致性 i 隔離性 d 永續性 隔離級別 讀未提交 會出現 髒讀,幻讀,不可重複讀 讀提交 幻讀 不重複讀 可重複讀 不可重複讀 序列化 序列化執行,效能較差 mysql 預設隔離級別是 可重複讀,但是網際網路專案的的資料庫隔離級別,建議設定成如提交,提高資料的效能 o...

各類資料庫分頁操作總結

1.oracle資料庫分頁 select from selecta.rownum rcfrom表名whererownum endrow awherea.rc startrow 2.db2資料庫分頁 select from selectrownumber over asrc,a.from select...

Mysql資料庫知識 Mysql索引總結

mysql資料庫知識 mysql索引總結 索引 index 是幫助mysql高效獲取資料的資料結構。下邊是自己整理的資料與自己的學習總結,做乙個彙總。一.真的有必要使用索引嗎?不是每乙個效能問題都可以通過建立乙個索引來解決 有很多其它解決效能問題的方式 a 各個應用層的快取,b 調優資料庫引數和緩衝...