[sql] 使用sql语句实现 Aprior 频繁二项集搜索
来源:互联网 发布:怎么安装虚拟机linux 编辑:程序博客网 时间:2024/05/17 09:10
这篇文章是关于在数据库中存放的一张简单表来依照 未经优化的Aprior 算法,
搜索频繁二项集的实验。 使用的SQL语句均通过验证,可以直接使用。
database : mysql
schema name : test
table name :
product
----------------------
pid | pname
----------------------
1 I1
2 I2
3 I3
4 I5
5 I2
6 I4
7 I1
8 I2
9 I3
10 I5
--------------------
首先,从数据库表 producer 生成一项集
SQL : select L1
use test ; drop table L1 ;-----------------------create table if not exists L1 ( id int not null AUTO_INCREMENT ,pname varchar(50) , count int ,primary key(id)) ;------------------------insert into L1 (pname ,count)select pname , count(*) from productgroup by (pname)having count(*) >= 2;-----------------------select * from L1 ;
SQL : select_C2
use test ;drop table C2 ;-----------------------create table C2 (id int auto_increment,cpname1 varchar (50) ,cpname2 varchar(50) ,primary key(id)) ;-----------------------insert into C2( cpname1,cpname2)select l1.pname , l2.pname from L1 l1 , L1 l2where l1.id < l2.id ;----------------------select * from C2 ;
SQL : select_C22:
use test ;drop table C22 ;-----------------------create table C22(id int auto_increment,ccpname1 varchar(50) ,ccpname2 varchar(50) ,count int ,primary key (id)) ;-----------------------insert into C22(ccpname1, ccpname2,count)select p1.pname ,p2.pname ,count(*)from product p1 ,product p2 , C2where p1.pname like C2.cpname1 and p2.pname like C2.cpname2 group by C2.cpname1,C2.cpname2having count(*) >= 3;---------------------select * from C22 ;
0 0
- [sql] 使用sql语句实现 Aprior 频繁二项集搜索
- 查看当前mysql使用频繁的sql语句
- 使用sql语句实现递归
- 搜索sql语句
- 如何用SQL语句实现精确搜索以及模糊搜索
- 如何用SQL语句实现精确搜索以及模糊搜索
- sqlite3 实现批量处理 sql语句,避免频繁操作数据库,从而影响性能的问题
- search搜索的sql语句
- 使用SQL语句实现备份、还原
- S2_day_02 使用sql语句实现数据库
- 使用SQL语句实现真分页
- 使用SQL语句实现SQL Profiler的功能
- 使用SQL语句实现SQL Profiler的功能
- sql实现搜索功能
- sql语句 实现分页
- SQL语句实现横排
- sql语句实现分页
- SQL语句实现分页
- red bottom heels as the market increasingly rare good things See.The Anhui Museum's collection with
- poj1753 广搜
- air max femme pas cher Tongzhi blue and white and other categories.This auction features the larges
- 使用zlib库的compress函数与uncompress函数
- 图像中带通滤波器和带阻滤波器的关系
- [sql] 使用sql语句实现 Aprior 频繁二项集搜索
- uboot移植---start.s分析
- HDU 1284 钱币兑换问题(完全背包:入门题)
- Java List拆分
- GCC中的编译选项“-I”(大写i),“-L”(大写l),“-l”(小写l)等参数
- 关于_beginthreadex和CreateThread的区别
- [swift]初始化方法自动继承
- affinity的解释与示例
- C++ 重载、重写、隐藏