mySQL基本知識

2021-06-07 05:20:59 字數 1449 閱讀 3302

五、字符集

ascii 128個 美式字符集

iso-8859-1(latin1) 西歐字符集 255個字元

gb2312 7千多個簡體漢字

gbk 2萬多個漢字 中文常用

utf-8 unicode字符集中最流行的一種實現方式  國際化用它

六、資料庫設計 sybase powerdesigner12.5

cdm 概念模型:來自使用者的需求:   --在資料建模中用e-r圖表示

實體(entity)-屬性(attribute)

實體之間的關係:一對

一、一對多、多對

一、多對多

pdm 物理模型:資料庫庫表設計:

表 - 列(字段)

外來鍵引用

七、事務--一組不可分割的sql操作

事務的acid屬性:原子性、一致性、隔離性、永續性

mysql的事務控制:

set autocommit=0;

sql的操作;

commit; #rollback;

set autocommit=1;

八、索引(index) create index 索引名 on 表名(列(length)...);

九、檢視(view)虛表 create view 檢視名 as select語句;

十、儲存過程和函式

delimiter //

create procedure 過程名(引數列表)   #in,out,inout

begin

sql語句

end //

delimiter ;

delimiter //

create function 函式名(引數列表) returns 返回值型別   #引數名 型別

begin

sql語句

end //

delimiter ;

十一、觸發器(trigger)

當某張表上發生特定事件觸發的一段sql程式

create trigger 名

on 表名

for each row 要觸發的sql語句;

十二、許可權管理

grant 許可權型別

on 物件型別

to 使用者物件[identified by '密碼']

[with grant option];

revoke 許可權型別

on 物件型別

from 使用者物件;

drop user 使用者名稱;

十三、資料的匯入匯出

匯出: mysqldump.exe命令 

例:mysqldump -u 使用者名稱 -p -c 資料庫名 > 目的地名

匯入: mysql.exe命令

例:mysql -u 使用者名稱 -p 資料庫名 < sql檔名

匯入也可以mysql客戶端中進行

mysql> source sql檔名;

mysql 基本知識

主要筆記 mysql幫助文件 1,比較常見的建立mysql表的方法 drop table if exists tablname create table tablename create defination table options a.create table if not exists ta...

mysql基本知識

映象複製 內容動態複製到其他計算機 gis函式 全文檢索 簡化對文字欄位內單詞的搜尋 不支援自定義資料型別 不支援xml myisam 靜態 預定義固定長度 儲存效率高 壓縮 減少儲存空間 innodb 支援事務,資料行級鎖定機制,外來鍵約束,不支援全文索引和gis資料 heap 存在於記憶體中,訪...

MySQL基本知識

1 bigint的length為20是什麼意思?2 64 18446744073709551616,共20位 只有儲存無符號整數,才能到20位 2 mysql中varchar最大長度是多少?3 mysql的length指的是顯示寬度 4 mysql的時間函式 5 timestamp 在建立新記錄和修...