当前位置:Gxlcms > 数据库问题 > mysql常用命令整理

mysql常用命令整理

时间:2021-07-01 10:21:17 帮助过:19人阅读

 

逻辑运算符

与,或,非

select 1|0, 1&0, !1;

 

异或

 

3.函数

数学函数

select abs(-1), pi(), sqrt(4), ceil(9.9), floor(9.9), round(9.9), round(9.1), sign(-3), pow(2,3), log(2,4);

技术图片

 

 

 字符串函数

select char_length(‘abc‘), concat(‘abc‘, ‘--‘, ‘abc‘);

技术图片

 

 

日期函数

select curdate(), now(), current_timestamp(), year(now()), month(now()), day(now());

技术图片

 

 

其他

select user(), version();

技术图片

 

 

 

 

 

 

4.索引

 

 

5.sql语句

库相关

create database  db1;

drop  database  db1;

表相关

create table t1 (id int);

 

创建表,自增

create table t1(id int auto

创建表,主键

create table t0(id int primary key, id2 int);

 

创建表,索引

 

删除表内容

删除表

 

update

 

 

replace

 

mysql常用命令整理

标签:mon   目录   字符串   img   data   concat   sel   整理   日期函数   

人气教程排行