数据库,简而言之可视为电子化的文件柜——存储电子文件的处所,用户可以对文件中的数据进行新增、截取、更新、删除等操作。所谓“数据库”是以一定方式储存在一起、能与多个用户共享、具有尽可能小的冗余度、与应用程序彼此独立的数据集合。
--产品数据重复统计
SELECT mc, userid, COUNT(mc) AS Expr1
FROM chanpin
GROUP BY mc, userid
--将不重复的纪录插入新表newchanpin
select * into #Tmp1 from chanpin
go
select min(ID) as autoID into #Tmp2 from #Tmp1 group by mc, userid
go
select * into newchanpin from #Tmp1 where ID in(select autoID from #tmp2)
--查找重复用户
--select distinct name from user_name
select * into #Tmp0 from user_name
go
select min(ID) as autoID into #Tmp6 from #Tmp0 group by admin
go
select * into newuser_name from #Tmp0 where ID in(select autoID from #tmp6)
--用户自定义类别
SELECT userlb AS Expr1, userid AS Expr2, COUNT(userlb) AS Expr3
FROM newuser_lb
GROUP BY userlb, userid
select * into #Tmp8 from user_lb
go
select min(ID) as autoID into #Tmp9 from #Tmp8 group by userlb, userid
go
select * into newuser_lb from #Tmp8 where ID in(select autoID from #tmp9)
--用户新闻
select bt, userid,count(bt) from user_news group by bt,userid
select * into #Tmp88 from user_news
go
select min(ID) as autoID into #Tmp99 from #Tmp88 group by bt,userid
go
select * into newuser_news from #Tmp88 where ID in(select autoID from #tmp99)
全新的路由器不仅让你更稳定快速地连接无线网络,更可以让家中的智能设备连接在一起。
……