MYSQL 事件调度的例子
1.SET GLOBAL event_scheduler = ON;
2.show processlist;
3.创建一个表 test 主要字段 no,name,sex,age
4.对该表插如几条数据
5.创建存储过程add_age
drop procedure if exists add_age;
delimiter|
create procedure add_age()
begin
start transaction;
update eventtest set age = age +1;
commit;
end;
|delimiter;
6.给当前用户赋予创建event的权限(或者换有权限的用户?)
7.创建event
create event if not exists add_age_one_minutes
on schedule every 1 minute
on completion preserve
do
call add_age();
(X该event每分钟执行一次)
相关文档:
这几天做一个查询,需要在一个指定的结果集中进行查询,例如:
select * from table_name where doc_id IN ('1dba', 'c20a', '907b')
其中IN子句中的doc_id列表是通过调用一个外部接口获得一组doc_id常量列表,然后在本地库中搜索符合这个列表的数据
记录。后来发现mysql返回的结果集的排序是按照入库顺序给出的,但是我 ......
MYSQL数据库中的常用SQL语句
1、SELECT 查询语句和条件语句
SELECT 查询字段 from 表名 WHERE 条件
查询字段:可以使用通配符* 、字段名、字段别名
表名: 数据库.表名 ,表名
常用条件: = 等于 、<>不等于、in 包含 、&nb ......
show variables like 'character%';查看字符编码
--更改字符集
SET character_set_client = utf-8 ;
SET character_set_connection = utf-8 ;
SET character_set_database = utf-8 ;
SET character_set_results = utf-8 ;
SET character_set_server = utf-8 ;
SET collation_connection = utf8 ;
SET colla ......
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MySql ......
一直习惯使用小写的SQL保留字,没想到今天居然遇到了麻烦哈!!和谐一下MYSQL啦!
环境:Server version: 5.1.37-1ubuntu5 (Ubuntu)
alter table child_table_name
add constraint constraint_name
foreign key (column_1)
references reference_table_name(reference_column_1);
和
ALTER TABLE child_t ......