简单常用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; 查询谓词:>,=,<,<>,!=,!>,!<,=>, ...
随机推荐
- LeetCode-11-7
1.Reverse String Write a function that takes a string as input and returns the string reversed. Exam ...
- 剑指offer面试54题
面试54题: 题目:二叉搜索树的第K大节点 题:给定一颗二叉搜索树,请找出其中的第k小的结点.例如, 5 / \ 3 7 /\ /\ 2 4 6 8 中,按结点数值大小顺序第三个结点的值为4. 解题思 ...
- MySQL 8.0的十大新特性
今天,让我们看一下MySQL8.0提升数据库管理员工作效率的十大改进. 从一大堆特性你们找出十点并不太容易,以下是这十大特性: 1.临时表的改进 2.持续的全局变量 3.取消默认MyISAM系统表 4 ...
- Django当中的sql查询
十二:在Django中使用sql 关键字: connection connections transaction insert/create/update/delete/sel ...
- [JavaScript]常用的页面倒计时
倒计时是web开发中比较常用的,以下列出常用的几个倒计时方法,仅供参考: 一 :页面倒计时 原理一般都是通过 setTimeout 或 setInterval 函数实现,下面是一个最简单的倒计时 &l ...
- 深度学习2--安装opencv3.1
1\opencv的安装参考视频 2\ 以下内容来自:http://blog.csdn.net/l18930738887/article/details/54696148 本人因为被坑过,所以建议各位最 ...
- Python socket编程之IO模型介绍(多路复用*)
1.I/O基础知识 1.1 什么是文件描述符? 在网络中,一个socket对象就是1个文件描述符,在文件中,1个文件句柄(即file对象)就是1个文件描述符.其实可以理解为就是一个“指针”或“句柄”, ...
- Link
GNU/Linux, Bash, C, PHP, Perl, JavaScript, Vim, Git http://blog.sanctum.geek.nz/about 中文數學詞典 http: ...
- [SCOI2005]超级格雷码
题目 BZOJ 洛谷 做法 爆搜真有意思 满足不重复且异或后仅一位为\(1\) 利用奇偶性交叉搜索(仅改变一位) My complete code #include<bits/stdc++.h& ...
- JSP 导出Excel表格
ES6语法 传入一个table的id,然后在导出excel按钮上加入一个<a href="#" id="buttonId">导出Excel</ ...