mysql常用命令整理
时间:2022-03-15 19:16
目录
1.数据类型
2.运算符
数学运算符
加减乘除,模除
select 10+3, 10-3, 10*3, 10/3, mod(10,3);
逻辑运算符
与,或,非
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