Changes between Initial Version and Version 1 of View5


Ignore:
Timestamp:
08/21/26 08:53:10 (26 hours ago)
Author:
235018
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • View5

    v1 v1  
     1= Customer request and response overview
     2
     3=== Description
     4This view provides a complete overview of customer requests, including the customer who submitted the request and the personnel member who answered it.
     5
     6The view is intended for:
     7
     8- customer support management
     9- tracking customer requests
     10- monitoring response activity
     11- analyzing customer satisfaction
     12
     13==== Tables covered by the view:
     14
     15- Client
     16- Request
     17- Personal
     18- makes_request
     19- answers
     20
     21==== SQL код
     22{{{#!sql
     23CREATE OR REPLACE VIEW vw_customer_request_response AS
     24SELECT
     25    r.request_num,
     26    r.date_and_time,
     27    r.problem,
     28    r.notes_of_communication,
     29    r.customer_satisfaction,
     30
     31    c.client_id,
     32    c.first_name AS client_first_name,
     33    c.last_name AS client_last_name,
     34    c.email AS client_email,
     35
     36    p.id AS employee_id,
     37    p.first_name AS employee_first_name,
     38    p.last_name AS employee_last_name
     39
     40FROM request r
     41JOIN make_request mr
     42    ON mr.request_num = r.request_num
     43JOIN client c
     44    ON c.client_id = mr.client_id
     45LEFT JOIN answers a
     46    ON a.request_num = r.request_num
     47LEFT JOIN personal p
     48    ON p.id = a.id;
     49
     50}}}
     51
     52==== Logic explanation
     53**1.** The `request` table provides the request details.
     54**2.** `make_request` connects each request with the client who submitted it.
     55**3.** `client` provides customer information.
     56**4.** `answers` connects requests with personnel members who answered them.
     57**5.** `personal` provides information about the employee.
     58**6.** LEFT JOIN is used for answers because a request may not have been answered yet.
     59
     60==== Reason for view
     61This view is useful because:
     62
     63- It combines customer and request information
     64- It shows which employee handled a request
     65- It supports customer-service monitoring
     66- It makes unanswered requests easier to identify
     67- It simplifies customer satisfaction analysis
     68
     69Without this view, the application would need to repeatedly join request, make_request, client, answers, and personal whenever customer request information is required.