A project requires a view to build a primary key, here's an example
CREATE or replace VIEW sme_v_a .... (Agentid,agentname,busynum,restnum,resttime,devicenonum,devicenosum
,CONSTRAINT agentstatic_pk PRIMARY KEY (agentid) RELY DISABLE novalidate)
As
SELECT A.agentid as Agentid,---seat number
(SELECT B.operator_name
From Cc_agent_info B
where b.work_no = A.agentid) as AgentName,----agent Name
NVL (SUM (C.busynum), 0) as Busynum,-----show busy times
NVL (SUM (C.restnum), 0) as Restnum,------number of breaks
NVL (SUM (C.resttime), 0) as resttime,------length of rest (minutes)
NVL (d.deviceno_num, 0) as Devicenonum,-------total number of words received
NVL (d.deviceno_sum, 0) as devicenosum-------total length of conversation
From Cc_v_ ..... A
Left JOIN ...
Left JOIN ...
GROUP by A.agentid, D.deviceno_num, d.deviceno_sum;
To see if a primary key already exists
Select A.constraint_name, a.column_name from user_cons_columns A, user_constraints b where a.constraint_name = B.constraint_name and b.constraint_type = ' P ' and a.table_name = ' sme_v_a .... '