目录 1 语法 2 哈希格式 3 运算符格式 3.1 对比 3.2 and 3.3 or 3.4 not 3.5 between和not between 3.6 in和not in 3.7 like 3.8 exists 熟悉Yii2的查询条件后,用Active Record查询数据非常方便. 以下我们介绍where()方法当中,条件的拼装方式. 1 语法 Yii2用where()方法(当然还有其他方法)来实现条件筛选,语法: public $this where ( $condition, $…
1.distinct select count(distinct CName) from Course select count(CName) from (select distinct CName from Course) as temp 2.group by ) from Course group by CName…
http://blog.csdn.net/qkxh320/article/details/16115671 1.首先操作mongodb最基本命令:: show databases; ---------------------显示全部数据库 use 数据库名; --------------------切换到指定数据库 show collections; --------------------显示该数据库下的全部表 之后就可以执行相应增删改查语句了! 2.…
1查询所有的列 select *from student 2查询指定列 select name,age from student 3查询时候使用别名 select name as 别名,age as 年龄 from student as可以省略 4查询增加常量列 //查询的时候加上一列专业 select id,name,age,addr,'就业办' as 专业 from student 5查询合并列 select name,(math+english) as 总成绩 from student…
一.准备工作 先把表建立好,方便一会查询. create table emp( id int not null unique auto_increment, name varchar(20) not null, sex enum("男","女") not null default "男", age int(3) unsigned not null default 18, hire_date date not null, post varchar(…
(7)范围查询select * from car where price>40 and price<60 --查询价格在40-60之间的select * from car where price between 40 and 60 --between...and... (8)离散查询 查询离散值,例如查询汽车价格是30.40.50.60等整数的select * from car where price=30 or price=40 or price=50 or price=…
目录 1)基本 2)数学函数 3)rownum 4)分页 5)时间处理 6)字符函数 7)to_number 8)聚合函数 9)学生选课 10)图书馆借阅 基本 --新建表: ) ) not null); --插入数据 insert into table1 (id,name) values ('aa','bb'); --更新数据 update table1 set id = 'bb' where id='cc'; --删除数据 delete from table1 where id ='cc';…