什么是投影和选择?
投影和选择有什么区别? 是:
- 投影--> 用于选择表的列; 和
- 选择---> 选择表的行?
那么投影和选择分别是垂直和水平切片吗?
What is the difference between projection and selection? Is it:
- Projection --> for selecting the columns of table; and
- Selection ---> to select the rows of table?
So are projection and selection vertical and horizontal slicing respectively?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
确切地。
投影意味着选择查询应返回哪些列(或表达式)。
选择表示要返回哪些行。
如果查询是
“a,b,c”是投影部分,“where x=3”是选择部分。
Exactly.
Projection means choosing which columns (or expressions) the query shall return.
Selection means which rows are to be returned.
if the query is
then "a, b, c" is the projection part, "where x=3" the selection part.
简而言之,PROJECTION 处理列的消除或选择,而SELECTION 处理行的消除或选择。
Simply PROJECTION deals with elimination or selection of columns, while SELECTION deals with elimination or selection of rows.
投影和选择是关系代数中的两个一元运算,在 RDBMS(关系数据库管理系统)中具有实际应用。
在实际意义上,投影是指从表中选择特定的列(属性),选择是指过滤行(元组)。 此外,对于传统表格,投影和选择可以称为垂直和水平切片或过滤。
维基百科通过示例提供了更正式的定义,它们有助于进一步阅读关系代数:
Projections and Selections are two unary operations in Relational Algebra and has practical applications in RDBMS (relational database management systems).
In practical sense, yes Projection means selecting specific columns (attributes) from a table and Selection means filtering rows (tuples). Also, for a conventional table, Projection and Selection can be termed as vertical and horizontal slicing or filtering.
Wikipedia provides more formal definitions of these with examples and they can be good for further reading on relational algebra:
投影:在 select 子句中输入的内容,即“列列表”或“*”或“表达式”,将成为投影下的内容。
*选择:*我们在该列上应用什么类型的条件,即获取选择的记录。
例如:
在上面的查询中,列“empno,ename,dno,job”属于投影,“where job='clerk'”属于选择
Projection: what ever typed in select clause i.e, 'column list' or '*' or 'expressions' that becomes under projection.
*selection:*what type of conditions we are applying on that columns i.e, getting the records that comes under selection.
For example:
in the above query the columns "empno,ename,dno,job" those comes under projection, "where job='clerk'" comes under selection