namespace ArrayList集合的语句示例{ class Program { static void Main(string[] args) { //一:Stack集合(没有索引) 先进后出,一个一个赋值,一个一个取值,按顺序 //Stack ss = new Stack(); //ss.Push("1"); //ss.Push("2&…
常规情况下的sql分组统计为: ) from 表 where 条件 group by 字段; 但是有时往往需要添加不同的条件已经去重的统计以上语句就不能满足需求. 解决方案为: 1.添加条件的统计方案: ELSE NULL END) xxx GROUP BY 分组字段 2.添加条件并去重的统计方案: COUNT(DISTINCT CASE WHEN 条件 THEN 去重字段 END) xxx GROUP BY 分组字段 综合示例: SELECT dc.user_sources AS source…
age = 22 #优化前 ''' for i in range(10): guess_num = int(input('input your guess num:')) if guess_num == age : print('Congratulations ! you got it.') elif guess_num > age: print('Think smaller!') else: print('Think Big...') ''' #优化后:要求输入用户名输入正确以后不执行语句 '…
左边是mongodb查询语句,右边是sql语句.对照着用,挺方便. db.users.find() select * from users db.users.find({"age" : 27}) select * from users where age = 27 db.users.find({"username" : "joe", "age" : 27}) select * from users where "us…
eg: 内连接: select student.*,grade.* from student join grade where student.sid=grade.sid; select s.*,g.* from student as s join grade as g where s.sid=g.sid; 外连接: 左连接(左边的主,左边的数据多有) select * from student left join grade on student.sid…
建表:(not null ,auto_increment, unique , primary key) create database balfish;use balfish;create table mytable1( id int not null, name varchar(20), grade int); insert into mytable1 values('1','yang',97);insert into mytable1 values('2','li',94)…
show variables like 'character_set_client';#查询字符集 show databases;#列出所有的服务器上的数据库alter create database if not exists test;#创建一个数据库 drop database fk;#删除数据库 show tables from test;#显示一个数据库中的表 use test; create table tb_dept( Id int primary key auto_increme…