select nnd as '年龄段',count(*) as '人数' from( select case when age>= and age<= then '1-10' when age>= and age<= then '11-20' when age>= and age<= then '21-30' when age>= and age<= then '31-40' when age>= and age<= then '41-50' w
先看例子: 1.delimiter $$2.drop procedure if exists`test_procedure` $$3.create procedure test_procedure(IN puser_id VARCHAR(30),IN pitem_id varchar(45),OUT result INT)4.begin 5.select id into result from train_tbl where user_id = puser_id;6.set result=10;
设置密码可使用 docker exec -it mysql01 bash --mysql01:数据库名字 mysql -u root -p ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';SELECT plugin FROM mysql.
1.查询数据(保证查询性能) SELECT * 和 SELECT t.id , t.name:后者性能其实总体优于前者. 2.在查询的时候最好给表起个 别名,方便找到表中要查询的字段.执行sql的进行多条件查询的时候,使用类如Navicat 之类的工具,按照下面这种格式写查询sql: and cus.uuid='' -- and cus.customerId='' and cus.customerName='' or cus.authState='' -- or cus.createTime='
1.创建students表mysql> create table students ( -> id int(10) auto_increment unique primary key, -> name varchar(20) not null, -> sex varchar(4), -> age int(10), -> class varch