连接表和视图的理论...... [英] Theory of join tables and views...

查看:51
本文介绍了连接表和视图的理论......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:

我最新的项目涉及为我们的客户服务部门创建一个小型服务台数据库。会发生什么事情,员工会打电话,解释他/她的问题,并获得一个票号。在问题被调查之后,他们将与决议联系,并且票证将被关闭。


因此我的数据库中的一个表, tblTicket ,将保存给定票证的各种信息。其中两条信息将是以下数字代码:1)接收呼叫的代理,以及2)解决故障单的代理。我分别称这些 fldReceivedBy fldResolvedBy ;它们都是整数,对于给定的记录,它们可能相同也可能不相同。


然后我来制作表来保存代理商信息 tblCustService 。这有 fldAgentCode (整数)和 fldAgentName 。这是我有点困惑的地方。如果整个过程只由一个人处理,那么我在 tblTicket 中需要的只有一个 fldAgentCode 来描述谁处理了问题,并建立了之间的关系tblTicket tblCustService 使用 fldAgentCode 作为密钥。但相反,我不得不想办法将 fldReceivedBy fldResolvedBy 联系起来 fldAgentCode


到目前为止,在我的数据库职业生涯中(大约一年半),我只听说过视图和连接表。但现在看来我可能需要它们。我理解连接表的功能和工作原理,但我不确定这是我需要的。然后我去看了一些关于视图的内容......但是我不确定我是否理解视图与连接有什么不同(甚至是对此问题的查询)。


底线是,视图和连接表之间有什么区别,它们中的任何一个都能帮助我解决当前的情况?感谢您阅读这个费力的解释,我期待着了解这一点...


Pat

Hi all:

My newest project involves creating a small help desk database for our customer service division to use. What will happen is that an employee will call up, explain his/her issue, and obtain a ticket number. After the problem has been investigated, they will be contacted with the resolution, and the ticket will be closed.

So one of the tables in my database, tblTicket, will hold various pieces of information for a given ticket. Two of those pieces of information will be the numeric code for: 1) the agent who received the call, and 2) the agent who resolved the ticket. I am calling these fldReceivedBy and fldResolvedBy respectively; they will both be integers, and they may or may not be the same for a given record.

Then I came around to making the table to hold the agent information, tblCustService. This has fldAgentCode (an integer) and fldAgentName. This is where I got somewhat confused. If the whole process were handled by one person only, then all I would need in tblTicket is one fldAgentCode to describe who handled the problem, and establish a relationship between tblTicket and tblCustService using fldAgentCode as the key. But instead, I''m left with having to figure out a way to relate fldReceivedBy and fldResolvedBy to fldAgentCode.

Up to this point in my database career (about a year and a half long), I''ve only heard of views and join tables. But it seems like now I may have a need for them. I understand what a join table does and how it works, but I''m not sure it''s what I need here. Then I went and read up a little on views...but I''m not sure I understand how a view is really any different from a join (or even a query for that matter).

The bottom line is, what''s the difference between a view and a join table, and can either of them help me in my present circumstance? Thanks for reading this laborious explanation, and I look forward to learning about this...

Pat

推荐答案


大家好:

我最新的项目涉及为我们的客户服务部门创建一个小型服务台数据库。会发生什么事情,员工会打电话,解释他/她的问题,并获得一个票号。在问题被调查之后,他们将与决议联系,并且票证将被关闭。


因此我的数据库中的一个表, tblTicket ,将保存给定票证的各种信息。其中两条信息将是以下数字代码:1)接收呼叫的代理,以及2)解决故障单的代理。我分别称这些 fldReceivedBy fldResolvedBy ;它们都是整数,对于给定的记录,它们可能相同也可能不相同。


然后我来制作表来保存代理商信息 tblCustService 。这有 fldAgentCode (整数)和 fldAgentName 。这是我有点困惑的地方。如果整个过程只由一个人处理,那么我在 tblTicket 中需要的只有一个 fldAgentCode 来描述谁处理了问题,并建立了之间的关系tblTicket tblCustService 使用 fldAgentCode 作为密钥。但相反,我不得不想办法将 fldReceivedBy fldResolvedBy 联系起来 fldAgentCode


到目前为止,在我的数据库职业生涯中(大约一年半),我只听说过视图和连接表。但现在看来我可能需要它们。我理解连接表的功能和工作原理,但我不确定这是我需要的。然后我去看了一些关于视图的内容......但是我不确定我是否理解视图与连接有什么不同(甚至是对此问题的查询)。


底线是,视图和连接表之间有什么区别,它们中的任何一个都能帮助我解决当前的情况?感谢您阅读这个费力的解释,我期待着了解这一点...


Pat
Hi all:

My newest project involves creating a small help desk database for our customer service division to use. What will happen is that an employee will call up, explain his/her issue, and obtain a ticket number. After the problem has been investigated, they will be contacted with the resolution, and the ticket will be closed.

So one of the tables in my database, tblTicket, will hold various pieces of information for a given ticket. Two of those pieces of information will be the numeric code for: 1) the agent who received the call, and 2) the agent who resolved the ticket. I am calling these fldReceivedBy and fldResolvedBy respectively; they will both be integers, and they may or may not be the same for a given record.

Then I came around to making the table to hold the agent information, tblCustService. This has fldAgentCode (an integer) and fldAgentName. This is where I got somewhat confused. If the whole process were handled by one person only, then all I would need in tblTicket is one fldAgentCode to describe who handled the problem, and establish a relationship between tblTicket and tblCustService using fldAgentCode as the key. But instead, I''m left with having to figure out a way to relate fldReceivedBy and fldResolvedBy to fldAgentCode.

Up to this point in my database career (about a year and a half long), I''ve only heard of views and join tables. But it seems like now I may have a need for them. I understand what a join table does and how it works, but I''m not sure it''s what I need here. Then I went and read up a little on views...but I''m not sure I understand how a view is really any different from a join (or even a query for that matter).

The bottom line is, what''s the difference between a view and a join table, and can either of them help me in my present circumstance? Thanks for reading this laborious explanation, and I look forward to learning about this...

Pat



G'' Day Pat,

在我们陷入困境之前,先为我清理一些事情。接听电话的人和解决问题的人是否来自同一群人?或者是你有一堆电话操作员和一堆独立的问题解决者?


Jim

G''Day Pat,
Just clear something up for me before we get stuck in. Are the people who take the calls and the people who resolve the issues drawn from the same group of people? Or is it that you have a bunch of phone operators and a seperate bunch of problem solvers?

Jim



G''Day Pat,

在我们陷入困境之前,先为我清理一些事情。接听电话的人和解决问题的人是否来自同一组人?或者是你有一堆电话运营商和一大堆问题解决者?


吉姆
G''Day Pat,
Just clear something up for me before we get stuck in. Are the people who take the calls and the people who resolve the issues drawn from the same group of people? Or is it that you have a bunch of phone operators and a seperate bunch of problem solvers?

Jim



他们是全部来自同一群人。在实践中,解决问题的人是大多数时间接收它的人,但不是所有时间。所以我试图解释最常见的情况,即在记录故障单后将问题交给另一个人......

They are all drawn from the same group of people. In practice, it will be the same person resolving the issue as receiving it most of the time, but not all the time. So I am trying to account for the most general case where the issue gets handed off to a different person after the ticket is logged...


Pat,


就我所理解的而言,View只是SELECT查询的另一个名称。 SQL Server使用术语视图为此我相信。

这里可能没有必要加入JOIN表。您只需在tblTicket记录中有两个字段(fldReceivedBy& fldResolvedBy),它们分别链接到同一个表(tblCustService)。以下SQL代码段提供了您需要的类型示例:
Pat,

A View IS just another name for a SELECT query as far as I understand it. SQL Server uses the term "View" for this I believe.
A JOIN table is probably not necessary here. You would simply have two fields in your tblTicket record (fldReceivedBy & fldResolvedBy) which link to the same table (tblCustService) separately. The following SQL snippet gives an example of the sort of thing you would need :
展开 | 选择 | Wrap | 行号


这篇关于连接表和视图的理论......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆