
使用where子句对表中的数据筛选,结果为true的行会出现在结果集中
语法如下:
select * from 表名 where 条件
例:
select * from students where id=1
1
2
3
where后面支持多种运算符,进行条件的处理
比较运算符
逻辑运算符
模糊查询
范围查询
空判断
比较运算符
等于: =
大于: >
大于等于: >=
小于: <
小于等于: <=
不等于: != 或 <>
例1:查询编号大于3的学生
select * from students where id >3
例:查询编号不大于4的学生
select * from students where id <= 4
1
2
3
4
5
6
逻辑运算符
and
or
not
例:查询编号大于3的女同学
select * from students where id >3 and gender=0
1
2
3
模糊查询
like
%表示任意多个任意字符
_表示一个任意字符
例:查询姓黄的学生
select * from students where name like '黄%'
1
2
3
范围查询
in表示在一个非连续的范围内
空判断
注意:null与’'是不同的
判空is null
例:查询没有填写身高的学生
select * from students where height is null
判非空is not null
1
2
3
4
优先级
优先级由高到低的顺序为:小括号,not,比较运算符,逻辑运算符
and比or先运算,如果同时出现并希望先算or,需要结合()使用
————————————————
qt creator怎么查询数据库内容:U-boot中有一个用来保存很多有用信息的全局结构体 --gd_t(global data缩写),其中包括了bd变量,可以说gd_t结构体包括了u-boot中所有重要全局变量。最后传递给内核的参数,都是从gd和bd中来的,如上 述的setup_memory_tags函数的作用就是用bd中的值来初始化RAM相应的tag。
对于ARM平台这个结构体的定义大致如下:
include/asm-arm/global_data.h
typedef struct global_data {
bd_t *bd
unsigned long flags
unsigned long baudrate
unsigned long have_console/* serial_init() was called */
unsigned long reloc_off/* Relocation Offset */
unsigned long env_addr/* Address of Environment struct */
unsigned long env_valid/* Checksum of Environment valid? */
unsigned long fb_base/* base address of frame buffer */
void **jt/* jump table */
} gd_t
在U-boot中使用gd结构之前要用先用宏DECLARE_GLOBAL_DATA_PTR来声明。这个宏的定义如下:
include/asm-arm/global_data.h
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")
从这个宏的定义可以看出,gd是一个保存在ARM的r8寄存器中的gd_t结构体的指针。
说明:本文的版本为U-boot-1.3.4、Linux-2.6.28,平台是ARM。
if(model->select()){
//有数据
}else
{
QMessageBox::warning(this,tr("警告"),tr("找不到相符号码!"),QMessageBox::Yes)
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)