美文网首页
sql 备忘

sql 备忘

作者: Albert_d37d | 来源:发表于2022-04-19 16:33 被阅读0次

-- create table prize_match_info

-- (

-- match_type int not null default  0,

-- match_name varchar(128) not null default '',

-- begin_time varchar(128) not null default '',

-- end_time varchar(128) not null default '',

-- price int  not null default 0,

-- player_count int not null default 100,

-- multiple int not null default 100,

-- is_open int not null default 1

-- );

--

--

--

-- create table prize_sign_up

-- (

--  match_type int,

-- date varchar(128) not null default '',

-- player_id varchar(128),

-- score bigint not null default 0

-- );

--

--

--  create index score on prize_sign_up(score);

--  create index date on prize_sign_up(date);

--

-- insert into prize_sign_up(match_type,date,player_id) values(7,curdate(),'46');

-- select * from prize_sign_up;

-- alter table prize_match_info add cur_session varchar(128) not null default '' after multiple;

-- select player_id,score from prize_sign_up where date=curdate() and match_type=7 order by score desc limit 50;

--

--  create table bag

-- (

-- player_id varchar(128) not null default '',

-- cards_recorder_expired_time datetime

-- );

--

-- alter table bag add UNIQUE(player_id);

-- select * from bag where cards_recorder_expired_time >= now();

-- alter table player auto_increment=100000;

-- create table friend_application_list

-- (

-- src varchar(128),

-- dst varchar(128),

-- tm TIMESTAMP not null default CURRENT_TIMESTAMP

-- );

--

-- create table friend_system

-- (

-- self varchar(128),

-- friend varchar(128),

-- tm TIMESTAMP not null default CURRENT_TIMESTAMP

-- );

--

-- create index self on friend_system(self);

--

-- select * from friend_application_list;

-- select * from friend_system;

-- select count(src) as count from friend_application_list where src='' and dst='';

-- alter table player add UNIQUE(id);

-- select id,nickname,head_icon_url,account from (select * from friend_application_list where dst='100002') as a left join player on player.id=a.dst;

-- select id,nickname,head_icon_url,account from (select * from friend_system where self='100000') as a left join player on player.id=a.friend;

-- select * from player;

-- select head_icon_url,nickname,account from player where account like '%te%' limit 50;

-- select id,head_icon_url,nickname,account from player where account like '%%' limit 50;

-- select * from emails where TO_DAYS(now()) - TO_DAYS(tm) < 4;

-- alter table player_email add COLUMN tm TIMESTAMP not null default CURRENT_TIMESTAMP;

-- insert into emails(email_type,title,content,with_item,email_item_id_1,email_item_num_1,email_id) values(0,'test7','content7',1,4,1,'E26D9D966C17451C86F66060791D0107');

-- drop table farm;

-- create table farm

-- (

-- player_id int,

-- growth_stage int UNSIGNED not null default 0,

-- humidity int UNSIGNED not null default 100,  -- 湿度

-- fertilization_times int UNSIGNED  not null default 0,  -- 施肥次数

-- fertilizer_number int UNSIGNED  not null default 0, -- 肥料数量

-- big_water_number int UNSIGNED  not null default 0, -- 大桶水数量

-- small_water_number int UNSIGNED  not null default 0, -- 小桶水数量

-- weed int UNSIGNED  not null default 2,  -- 是否有杂草 1 有  2 无

-- pest int UNSIGNED  not null default 2 -- 是否有虫子

-- );

--

-- alter table farm add UNIQUE(player_id);

-- create table farm_friend_fertilization_recorder

-- (

-- self varchar(128),  -- 自己

-- friend varchar(128), -- 帮助的好友

-- help_times int,  -- 帮助次数

-- tm TIMESTAMP not null default CURRENT_TIMESTAMP

-- );

--

-- create index self on farm_friend_fertilization_recorder(self);

-- desc sign_in;

-- create table farm_sign_in

-- (

-- player_id varchar(128),

-- day1 TINYINT not null default 2,

-- day2 TINYINT not null default 2,

-- day3 TINYINT not null default 2,

-- day4 TINYINT not null default 2,

-- day5 TINYINT not null default 2,

-- day6 TINYINT not null default 2,

-- day7 TINYINT not null default 2,

-- the_last_sign_in_day varchar(128)

-- );

-- alter table farm_sign_in add UNIQUE(player_id);

-- desc farm_sign_in;

--  insert IGNORE into farm(player_id) values('123');

-- update farm set growth_stage=(

-- case

-- when growth_stage>=7 then 0

-- else growth_stage + 1

-- end

-- ) where player_id='100000';

-- select * from farm;

-- create table charge

-- (

-- player_id varchar(128),

-- goods_id int,

-- tm TIMESTAMP not null default CURRENT_TIMESTAMP

-- );

--

-- create index player_id on charge(player_id);

--

-- select score,rank,nickname,head_icon_url from (select b.* from (select t.* ,@rank := @rank + 1 as rank from(select @rank := 0) r,

-- (select player_id,score from prize_sign_up where date=curdate() and match_type=7 order by score desc) as t)

-- as b where b.player_id='100001') as a left join player on a.player_id = player.id;

select * from prize_sign_up;

select * from player;

相关文章

  • sql备忘

    连接字符串格式 : connectionString="data source=.;initial catalog...

  • SQL备忘

    对大小写不敏感 一些最重要的 SQL 命令 查询 插入 指定行更新 和 删除:

  • Sql备忘

    SQL分为: DML 数据操纵语言:增删改查 DDL 数据定义语言:CREATE DROP 索引 ALTER DC...

  • SQL备忘

    Windows查看本机端口使用情况 netstat -nab JDBC连接错误 Cannot create Poo...

  • sql 备忘

    -- create table prize_match_info -- ( -- match_type int ...

  • mysql备忘SQL

    表tb_journal_metric有主键自增id字段和jguid,type,year三个字段组成的联合唯一索引。...

  • postgresql自定义函数语法

    最近在写postgres的函数,整理下常用语法备忘 定义内部变量 执行动态sql,并传入参数 执行动态sql,取出...

  • T-SQL备忘

    作为一个"浸淫" Oracle 数据库很久的人来说, 突然转入 T-SQL, 也就是 MSSQL , 工作中经常用...

  • SQL | 备忘录

    常用函数 计算字段长度:LENGTH() 计算array长度:SIZE() 查询一个a对应多个b的情况 查询出现次...

  • ORACLE 常用PL/SQL备忘

    ORACLE 多表关联 UPDATE 语句 Oracle中的EXISTS与IN 改字段类型 列转行函数 Oracl...

网友评论

      本文标题:sql 备忘

      本文链接:https://www.haomeiwen.com/subject/ixosertx.html