SQL SERVER 呼叫中心練習題

2021-09-08 23:50:24 字數 3514 閱讀 1991

create table [callrecords]

([id] [int] not null identity(1,1),

[callernumber] [nvarchar](50), --三位數字,呼叫中心員工編號(工號)

[telnum] [varchar](50),

[startdatetime] [datetime] null,

[enddatetime] [datetime] null  --結束時間要大於開始時間,預設當前時間

)--主鍵約束

alter table [callrecords]

add constraint pk_callrecords primary key(id)

--檢查約束

alter table [callrecords]

add constraint ck_callrecords check(callernumber like '[0-9][0-9][0-9]')   

alter table [callrecords]

add constraint ck_callrecords_enddatetime check(enddatetime > startdatetime)

--預設約束

alter table [callrecords]

add constraint df_callrecords default(getdate()) for enddatetime

insert [dbo].[callrecords] ([callernumber], [telnum], [startdatetime], [enddatetime]) values ('001', '0208888888', cast(0x00009daf00a4cb80 as datetime), cast(0x00009daf00a62e94 as datetime));

insert [dbo].[callrecords] ([callernumber], [telnum], [startdatetime], [enddatetime]) values ('001', '0208888888', cast(0x00009db000d63bc0 as datetime), cast(0x00009db000d68dc8 as datetime));

insert [dbo].[callrecords] ([callernumber], [telnum], [startdatetime], [enddatetime]) values ('001', '89898989', cast(0x00009db000e85c60 as datetime), cast(0x00009db000e92f50 as datetime));

insert [dbo].[callrecords] ([callernumber], [telnum], [startdatetime], [enddatetime]) values ('002', '98987676', cast(0x00009db2015bb7a0 as datetime), cast(0x00009db2015c4da0 as datetime));

insert [dbo].[callrecords] ([callernumber], [telnum], [startdatetime], [enddatetime]) values ('002', '02188839389', cast(0x00009da4014c9c70 as datetime), cast(0x00009da4014e0308 as datetime));

insert [dbo].[callrecords] ([callernumber], [telnum], [startdatetime], [enddatetime]) values ('001', '767676766', cast(0x00009db400daa0c0 as datetime), cast(0x00009db400dd5fe0 as datetime));

insert [dbo].[callrecords] ([callernumber], [telnum], [startdatetime], [enddatetime]) values ('003', '0227864656', cast(0x00009db200b9ab40 as datetime), cast(0x00009db200b9fc1c as datetime));

insert [dbo].[callrecords] ([callernumber], [telnum], [startdatetime], [enddatetime]) values ('003', '676765777', cast(0x00009db8014042b8 as datetime), cast(0x00009db80141804c as datetime));

insert [dbo].[callrecords] ([callernumber], [telnum], [startdatetime], [enddatetime]) values ('001', '89977653', cast(0x00009d9a00fb9898 as datetime), cast(0x00009d9a00fe6118 as datetime));

insert [dbo].[callrecords] ([callernumber], [telnum], [startdatetime], [enddatetime]) values ('004', '400400400', cast(0x00009d9a00fb9898 as datetime), cast(0x00009d9a00fe6118 as datetime));

----查詢通話時間最長的5條記錄

select top 5 datediff(second,startdatetime,enddatetime) as timelength from dbo.callrecords

order by timelength desc

----查詢以0開頭的通話總時,以秒為計算單位

select sum(datediff(second,startdatetime,enddatetime)) from dbo.callrecords where telnum like '0%'

----查詢2023年7月通話總時長最多的前兩個呼叫員的編號

select top 2 callernumber

from 

dbo.callrecords 

where

datediff(month,'2010-7-1',startdatetime) = 0  

group by callernumber

order by sum(datediff(second,startdatetime,enddatetime)/60) desc

----查詢2023年7月撥打**次數最多的前兩個呼叫員的編號

select top 2 callernumber

from 

dbo.callrecords 

where

datediff(month,'2010-7-1',startdatetime) = 0

group by callernumber

order by count(*) desc

呼叫中心構想

支援目前呼叫中心業務需要的各種業務,如坐席,多 接入,ivr處理,類似於國內外許多專有的呼叫中心產品,cti中介軟體,但要更加靈活,更多基於開源的構件和框架,吸引更多的人加入。asterisk是乙個非常成功的例子,但其原始意圖很簡單,就是打 目前許多功能都是有些牽強新增的,而且效能方面有點問題。並且...

呼叫中心企業

參考 華為技術 阿爾卡特朗訊 genesys,阿爾卡特朗訊旗下公司 dialogic公司 中國聯通 中國電信集團號百資訊服務 北京英立訊科技 杭州遠傳通訊技術 奧迪堅通訊系統 上海 繽特力 蘇州 新太科技股份 深圳市東進通訊技術股份 teleopti 廣州市毅航通訊技術 潮流網路技術 杭州三匯資訊工...

呼叫中心回庫

資料採集 基礎資料 proj info,cust tbl p collect base data call center,是否更新表 base info,是否匯入新資料 自定義列 def info,def value p collect def call center 問卷資料 bj survey ...