mysql一些常用sql语句

database

-- 修改表注释

ALTER table table_name comment "需要修改注释的信息";

-- 修改root 密码

ALTER USER "root"@"localhost" IDENTIFIED BY "123456";

--授权远程访问

grant all privileges on *.* to "root"@"%" identified by "123456";

-- 更新表数据

UPDATE table_name set 字段1 = 字段值1字段2 = 字段值2 where 查询条件1=条件值1 and ...;

-- 查询计划

EXPLAIN

select * from table_name t

-- 带序号的查询

SELECT (@rownum := @rownum +1) AS rownum , lo.order_id FROM orders lo,(SELECT @rownum := 0) WHERE lo.order_status in ("3","4","5")

--查询ASCII码

select ascii("a");

--查询数据库版本

SHOW VARIABLES WHERE Variable_name = "version";

以上是 mysql一些常用sql语句 的全部内容, 来源链接: utcz.com/z/533550.html

回到顶部