欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

mysql-sample sql_MySQL

程序员文章站 2024-02-01 15:22:28
...
1) show databases;

2) use db; 进入到数据库db

3) select database(); --显示当前数据库

4) select "consstr" as colname, t.* from tableName t;

5) select a.id,a.valueA, case (b.valueB is NULL) when 1 then 'z' else b.valueB end from tableA as a left join tableB as b on(id);

6)导入.sql脚本:

  在命令行下:mysql -h *** -u *** -p

进入到mysql,在mysql>命令行下: source **.sql


7)在mysql中可以让查询结果的每行竖排列,只需要用/G代替查询语句末尾的分号即可。如:

  select * from test limit 10 /G

8)show tables like '%name%';

相关标签: 数据库