如何隐藏表中的列名 [英] How to hide a column name from the table

查看:93
本文介绍了如何隐藏表中的列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我需要隐藏结果表中的特定列名,但是数据应该存储在数据库中。不应该删除,但只是它应该是不可见的。



我尝试了什么:



因为我是sql的新手我需要正确的来自专家的指导。请解决我的查询

Hi All
I need to hide a particular Column Name from the result table but that datas should be stored in the Database.Should not be deleted,but Just it should be Invisible.

What I have tried:

Since i am new to sql i need proper Guidance from the experts here.Please Solve my query

推荐答案

不要在SELECT语句中列出它。

而不是做

Don't list it in the SELECT statement.
Instead of doing
SELECT * FROM MyTable

仅列出您要查看的列:

List only the columns You want to see:

SELECT ColumnIWant, OtherColumnIWant, LastColumnIWant FROM MyTable

你应该养成这样做的习惯:永远不要检索你不需要的列(它效率低,可能占用大量带宽如果你不小心) - 它可以使你的合作更强大,因为它可以处理DB表的更改而无需更改。

You should get into the habit of doing this anyway: never retrieve columns you don't need (it's inefficient and can take a lot of bandwidth if you aren't careful) - and it can make your code more robust, in that it can cope with changes to the DB table without needing changes.


明确定义要返回的字段而不是使用select *这是你应该做的事情无论如何



Explicitly define the fields you want back rather than using "select *" which is something you should do anyway

Person
------
ID, Name, EmailAddress







SELECT ID, Name FROM Person





以上将创建一个只有ID和Name的结果集,而不是EmailAddress。



The above will create a result set with just ID and Name, not EmailAddress.


这篇关于如何隐藏表中的列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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