SQL 基础笔记
来源:互联网 发布:今年欧文总决赛数据 编辑:程序博客网 时间:2024/05/24 03:48
创建用户:
CREATE USER username IDENTIFIED BY 'password';
授权:
GRANT privileges ON databasename.tablename TO username;
flush privileges; 刷新权限表
查询 最后一条语句
select * from TABLE where (select max(ID) from TABLE)
删除 id 为 1的行
delete from TABLE where id=1;
distinct 仅找出不同的选项
SQL函数
avg函数:计算查询中某一特定字段资料的算术平均值。
count函数:计算符合查询条件的记录数。
min, max函数:传回指定字段之中符合查询条件的第一条、最末条记录的资料。
first, last函数:传回指定字段之中符合查询条件的最小值、最大值。
stdev函数:计算指定字段之中符合查询条件的标准差。
sum函数:计算指定字段之中符合查询条件的资料总和。
var,函数:计算指定字段之中符合查询条件的变异数估计值。
存储过程与预处理的不同:
摘自:http://stackoverflow.com/questions/7296417/difference-between-stored-procedures-and-prepared-statements
Stored procedures are a sequence of instructions in PL/SQL language. Is a programming language implemented by some DBMS, that lets you store sequences of queries frequently applied to your model, and share the processing load with the application layer.
Prepared statements are queries written with placeholders instead of actual values. You write the query and it is compiled just once by the DBMS, and then you just pass values to place into the placeholders. The advantage of using prepared statements is that you enhance the performance considerably, and protect your applications from SQL Injection.
The difference is you cant store prepared statements. You must "prepare" them every time you need to execute one. Stored procedures, on the other hand, can be stored, associated to a schema, but you need to know PL/SQL to write them.
- SQL基础笔记
- SQL学习基础笔记
- SQL 基础笔记
- 一.sql基础笔记
- SQL 基础笔记
- sql基础笔记
- SQL基础笔记
- SQL基础笔记
- SQL基础笔记
- SQL基础笔记
- SQL基础笔记-1
- sql操作基础学习笔记
- oracle10g sql查询基础笔记
- T-SQL基础 学习笔记
- SQL基础学习笔记【Forward】
- SQL学习笔记-基础学习
- 学习笔记-SQL基础语法
- 【个人笔记】SQL操作基础
- 第六讲:Obj-C 内存管理4 - 自动释放池
- 史玉柱:一个创业过来人的脚印
- 【vim】vim和shell命令的交互
- datagridview设置默认单元格格式用以显示特定时间格式
- eclipse debug (调试) 学习心得
- SQL 基础笔记
- oracle 监控
- 成长记录--策略模式
- 2012的项目总结
- 完美解决透明png图片及透明png背景,兼容大多浏览器
- 医学图像质量评价方法SSIM
- 分享一些OpenCV实现立体视觉的经验
- 第七讲:Obj-C 协议 Protocol
- 网站提取工具