有關MySQL的一些整理

2021-09-26 20:33:26 字數 1203 閱讀 6564

在日常的使用中我經常的會忘記一些sql語句的使用方法,這裡就整理了一下,方便以後使用。

create table person(

id bigint(8) not null auto_increment comment '主鍵id',

person_name varchar(32) not null comment '姓名',

person_age int(4) not null comment '年齡',

person_id varchar(18) not null comment '身份證號',

create_time datetime(0) null default null comment '建立時間',

update_time datetime(0) null default null comment '更新時間',

descripe varchar(128) null default null comment '注釋',

primary key (`id`) using btree

) engine = innodb auto_increment = 1 character set = utf8 collate = utf8_general_ci comment = '個人資訊表' row_format = compact;

儲存引擎使用innodb,能增加併發讀時使用者數量並提高效能。

drop table if exists `person`;
alter table person add person_*** varchar(4) comment '性別';
alter table person drop person_***;
alter table person modify person_age varchar(4);
alter table person change person_age age int(4);
alter table person add index index_person_name(person_name);
drop index index_person_name on person;

整理mysql的一些特殊用法

mysql連貫字串不能利用加號 而利用concat。比方在aa表的name欄位前加字元 x 利用 update aa set name concat x name 字段時間資料型別為datatime 可使用to days 欄位名 將時間轉換為乙個數字 計算兩個日期差值 可以用這個數字做差 例如 se...

Mysql的基礎的一些整理1

mysql的一些整理 1.sql的分類 1 ddl data definition language 資料定義語言用來定義資料庫物件 資料庫 表 列等。關鍵字create drop alter等等。2 dml data manipulation language 資料庫操作語言,用來對資料庫的表上的...

有關鉤子的一些東西

前段時間開始轉型用vc7寫東西,做了些東西,感覺vc7的智慧型感應確實比vc6要好用很多,某天,打算用vc7做個鉤子程式,於是先把以前用vc6做的乙個程式在vc7裡重寫一遍,結果一呼叫就提示嚴重錯誤.很奇怪,看了看鉤子的那個類,似乎沒什麼錯,在裝鉤子的函式裡加了個messagebox,再呼叫,發現可...