CodeSnippet/sql/sql_examples.sql

37 lines
1.2 KiB
SQL

use test;
insert into temp values("gr", 108333, "goooogle");
#insert into account values(12, 1.2)
#insert into account values(13, 1.4)
#SET @ret=redis_command_v2("127.0.0.1",6379,"set","greenp",
# json_object
# (
# NEW.id as "id",
# NEW.name as "userName",NEW.title as "title"
# )
# );
# three different mysql operation.
#update tablename set colum=newvalue where condition;
#update amount set amount=1.4 where acct_num=1;
#delete from tablename where condition;
#delete from account where acct_num<200;
#insert into tablename values(a1,a2), (b1,b2);
#insert into account values(17, 17.2);
# (eleName)
select * from <table-name> where a="avalue" group by `eleName` having count(eleName)<>1
# app进行分组统计金额
SELECT app as , sum(total_amount) as FROM order WHERE uid=2216620 and state='PAYED' GROUP BY app;
#
select distinct domainKey from MetaInfo;
# (user中字段name的长度为50)
alter table user modify column name varchar(50);
# null的值为新值
update mp_markdown_meta set post_time='1970-01-01 00:00:00' where isnull(post_time) ;