mysql-sample sql_MySQL
程序员文章站
2024-01-26 16:55:58
...
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%';