简单SQL语句
2015-10-16 15:23
411 查看
1、说明:几个简单的基本的sql语句
SELECT CONCAT('update ',table_schema,".",table_name," set schoolId=149;") FROM `information_schema`.columns WHERE table_schema='idsp_jn14' AND column_name='schoolId'在MySQL中执行完如下update idsp_jn14.bas_classroom set schoolId=149;conca()是MySQL中的字符串拼接函数`information_schema`.columns 是信息数据库,其中保存着关于MySQL服务器所维护的所有其他数据库的信息
选择:select * from table1 where 范围 插入:insert into table1(field1,field2) values(value1,value2) 删除:delete from table1 where 范围 更新:update table1 set field1=value1 where 范围 查找:select * from table1 where field1 like ’%value1%’ ---like的语法很精妙,查资料! 排序:select * from table1 order by field1,field2 [desc] 总数:select count as totalcount from table1 求和:select sum(field1) as sumvalue from table1 平均:select avg(field1) as avgvalue from table1 最大:select max(field1) as maxvalue from table1 最小:select min(field1) as minvalue from table1 MySQL中
SELECT CONCAT('update ',table_schema,".",table_name," set schoolId=149;") FROM `information_schema`.columns WHERE table_schema='idsp_jn14' AND column_name='schoolId'在MySQL中执行完如下update idsp_jn14.bas_classroom set schoolId=149;conca()是MySQL中的字符串拼接函数`information_schema`.columns 是信息数据库,其中保存着关于MySQL服务器所维护的所有其他数据库的信息
相关文章推荐
- MySQL批量导出、导入文本数据
- django 操作mongoDB Mongoengine教程(1)——概述
- 十步完全理解SQL
- Nutch2.3 + Mysql(错误解决方案)
- 数据库SQL性能查询
- MySQL九读书笔记 字符串模式匹配
- SQL Server中的事务日志管理(2/9):事务日志架构概述
- Oracle duplicate搭建dataguard (Backup-based duplication)
- oracle开启闪回
- SQL Server比较常见数据类型详解
- oracle 11G DG物理备库与快照备库的互相转换
- oracle运行失败的类型
- MySQL用户远程访问权限开通
- oracle中number数据类型对应java中的基本数据类型
- windows下编译redis
- windows下编译redis
- windows下安装php5.5的redis扩展
- 如何批量修改mysql表的引擎
- sql server 动态排序
- 数据库信息方法:Info API-Medoo使用指南