Home  >  Article  >  Database  >  mysql-sample sql_MySQL

mysql-sample sql_MySQL

WBOY
WBOYOriginal
2016-06-01 13:52:081615browse

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%';

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn