在SQL查询select * from table_name中*的工作是什么? [英] What is the work of * in SQL query select * from table_name?

查看:465
本文介绍了在SQL查询select * from table_name中*的工作是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们从table_name编写select *时,由于*符号确实在数据库中发生了什么?

,数据库中发生了什么?

它会选择全部记录或一个一个地去?

what does really happen in database due to * symbol??
when we wrote select * from table_name, what is happening in database?
will it be selecting all records or going by one by one?

推荐答案

如果你有一个包含字段field1,field2,field3的表,你从那个表中选择*它与< br $>


If you have a table with fields field1, field2, field3 and you select * from that table it is the same as

select field1, field2, field3





但是,为了找出哪些字段可用,它必须查询表的模式,以便您需要更多的工作。这是不使用select *的几个原因之一*



However in order to find out what fields are available it has to query the schema of the table so you get more work required. It's one of the several reasons not to use select *


* 没什么特别的,它只是所有列的占位符表格。



一般在RDBM中,数据在页面中读取,然后根据查询计划和过滤选项合并输出,其具体情况取决于有问题的引擎。
* is nothing special, it is just a placeholder for all the columns in the table.

Generally in RDBM's, data is read in pages then consolidated for the output based on the query plan and filtering options, the specifics of which is dependent on the engine in question.


这篇关于在SQL查询select * from table_name中*的工作是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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