Mysql命令、常用函数

时间:2023-03-08 16:54:11

一、sql命令行

查看数据库 show database ;
选择使用的数据库 use 数据库名  ;
查看表 show tables ;
查询表 select * from 表名
   
高版本mysql语句 注:mysql内置库 名:information_schema
查库 select schema_name from information_schema.schemata
查表 select table_name from information_schema.tables where table_schema='库名'
查列 select column_name from information_schema.columns where table_name='表名'
查字段 select 列1,列2,列3 from 库名.表名

Mysql命令、常用函数

Mysql命令、常用函数

Mysql命令、常用函数

mysql的 information_schema 库的 columns 表 详情可见 https://www.cnblogs.com/yoyo1216/p/10785898.html

二、SQL常用函数

查询函数

1.version()   --Mysql版本

2.user()  --数据库用户名

3.database()  --数据库名

4.@@datadir  --数据库安装路径

5.@@version_compile_os  --操作系统的版本

字符串连接函数:

1.concat(字符串1,字符串2)   --没有分隔符的连接字符串

2.concat_ws(-/~,字符串1,字符串2)  --含有分隔符的连接字符串

3.group_concat(字符串1,字符串2)    --连接一个组的所有字符串,并用,分隔每一个字符。

详情见:https://baijiahao.baidu.com/s?id=1595349117525189591&wfr=spider&for=pc