简单常用sql查询
[self.db executeUpdate:sql, record.recordID];
CREATE TABLE scene_record(id TEXT PRIMARY KEY, record_time TEXT, location TEXT,place TEXT,description TEXT,isUpdate TEXT,is_delete TEXT)
按生序查询,并指定查询值
SELECT * FROM scene_record where isUpdate = 1 or isUpdate = 2 order by record_id asc
按降序排列
SELECT * FROM scene_record where isUpdate = 1 or isUpdate = 2 order by record_id desc
条件查询
SELECT * FROM scene_record where isUpdate = 1 or isUpdate = 2
未指定查询值
select * from scene_record where name=?
查询最大id
select max(id) from scene_record
从搜索结果中搜索
select * from info_tag where parent_id = (select parent_id from info_tag where id=?)
带有or的条件搜索
SELECT * FROM scene_record_detail where (is_upload = 1 and is_delete = 0) or (is_upload = 2 and is_delete = 0)
插入语句:
插入表中的一列数据
insert into custom_classify (name) values(?)
[self.db executeUpdate:sql,classifyName];
插入全部数据:
insert into scene_record values(?,?,?,?,?,?,?)
[self.db executeUpdate:sql,record.recordID,record.recordTime,location, record.place, record.sceneRecordDescription, @"1", @"0"];
插入指定列:
insert into scene_record (record_id,record_time,location,place,description,isUpdate,is_delete) values(?,?,?,?,?,?,?)
[self.dbexecuteUpdate:sql,record.recordID,record.recordTime,record.location,record.place,record.sceneRecordDescription,@"2",@"0"];
更新语句:
根据record_id更新一列is_delete
update scene_record set is_delete = 1 where record_id = ?
[self.db executeUpdate:sql, record.recordID];
根据record_id跟新多列location,place,description,isUpdate
update scene_record set location = ?, place = ?, description = ?, isUpdate = 1 where record_id = ?
删除语句:
删除全部:
delete from test_table
PS:注意这里没有*
简单常用sql查询的更多相关文章
- [转] 常用SQL查询语句
sunada 的原文地址 常用SQL查询语句 一.简单查询语句 1. 查看表结构 SQL>DESC emp; 2. 查询所有列 SQL>SELECT * FROM emp; 3. 查询指 ...
- 发送json-简单的传参查询和简单的sql查询
简单的传参查询并转化为json using System; using System.Collections.Generic; using System.Linq; using System.Web; ...
- 记一个简单的sql查询
在我们做各类统计和各类报表的时候,会有各种各样的查询要求.条件 这篇主要记录一个常见的统计查询 要求如下: 统计一段时间内,每天注册人数,如果某天没有人注册则显示为0 现在建个简单的表来试试 建表语句 ...
- Oracle常用SQL查询(2)
三.查看数据库的SQL 1 .查看表空间的名称及大小 select t.tablespace_name, round ( sum (bytes / ( 1024 * 1024 )), 0 ) ts ...
- Oracle常用SQL查询
一.ORACLE的启动和关闭 1.在单机环境下要想启动或关闭oracle系统必须首先切换到oracle用户,如下: su - oracle a.启动Oracle系统 oracle>svrmgrl ...
- ORACLE 常用SQL查询
一.ORACLE的启动和关闭 1 .在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle a.启动ORACLE系统 oracle > sv ...
- 一条简单的 SQL 查询语句到底经历了什么?
一.MySQL 基础架构 整体来说 MySQL 主要分为两个部分,一个部分是:Server 层,另一部分是:存储引擎层. 其中 Server 层包括有连接器.查询缓存.分析器.优化器.执行器等,存 ...
- 常用SQL查询语句
一.简单查询语句 1. 查看表结构 SQL>DESC emp; 2. 查询所有列 SQL>SELECT * FROM emp; 3. 查询指定列 SQL>SELECT empmo, ...
- 测试工作常用SQL查询语句
一.查询数值型数据: SELECT * FROM tb_name WHERE sum > 100; 查询谓词:>,=,<,<>,!=,!>,!<,=>, ...
随机推荐
- [转+整理]linux shell 将字符串分割成数组
原文链接:http://1985wanggang.blog.163.com/blog/static/776383320121745626320/ a="one,two,three,four& ...
- Eclipse Find/Replace
1.Eclipse内容助手 选中Regular expressions,使用正则表达式进行匹配.图中出现了小黄灯,Ctrl+Space显示出帮助信息. 2.Wrap search(循环检索)选中后,检 ...
- MySQL-LRU_List Free_List Flush_List
关于 LRU_List ,Free_List,Flush_List的介绍: LRU算法:(Latest Recent Used)最近最少使用 数据库的缓冲池通过LRU算法来进行管理. ...
- 用nodejs实现读取文件操作
//如果不是全局就得引入fs成员 const fs = require("fs"); //fs 核心模块中提供了一个 fs.readFile方法,来读取指定目录下的文件 //fs. ...
- Cocos2d-x项目移植到WP8系列之一:前传
原文链接: http://www.cnblogs.com/zouzf/p/3969993.html 许久没动笔了,随想一直都有动笔的想法,但拖来拖去,归根到底还是一个懒字吧 .发现人的惰性真是太强大了 ...
- Docker 三剑客
Docker三剑客: Docker-Machine Docker Machine is a tool that lets you install Docker Engine on virtual ho ...
- RazorEngine性能研究(反射的延深)
先说下结论 1)RazorEngine 确实很慢,编译过程特别慢,编译过后仍不适合大量重复调用的情况(一次调用可以接受). 2 ) RazorEngine 和 asp.net mvc 里的Razo ...
- Why does typeof array with objects return “Object” and not “Array”?
https://stackoverflow.com/questions/4775722/check-if-object-is-an-array One of the weird behaviour a ...
- 【BZOJ2818】Gcd (欧拉函数)
网址:http://www.lydsy.com/JudgeOnline/problem.php?id=2818 一道数论裸题,欧拉函数前缀和搞一下就行了. 小于n的gcd为p的无序数对,就是phi(1 ...
- myeclipse下搭建hadoop2.7.3开发环境
需要下载的文件:链接:http://pan.baidu.com/s/1i5yRyuh 密码:ms91 一 下载并编译 hadoop-eclipse-plugin-2.7.3.jar 二 将had ...