基于这一问题, 从表选择NOT NUL栏 其中一个海报说
页: 1
www.un.org/chinese/ecosoc 在生产服务器的神秘盘问中,我们是否应当使用选择性产品? 如果是,为什么我们不使用什么?
基于这一问题, 从表选择NOT NUL栏 其中一个海报说
页: 1
www.un.org/chinese/ecosoc 在生产服务器的神秘盘问中,我们是否应当使用选择性产品? 如果是,为什么我们不使用什么?
大多数人反对在生产中使用<代码>SélectT*>,因为这往往会中断生产。 但有一些例外。
SELECT *
fetches all columns - while most of the times you don t
need them all. This causes the SQL-server to send more columns than
needed, which is a waste and makes the system slower.SELECT *
, when you later add a column, the old query will also
select this new column, while typically it will not need it. Naming
the columns explicitly prevents this.SELECT *
queries also tend to grab the rows
and use column order to get the columns - which WILL break your code
once columns are injected between existing columns.SELECT *
might behave differently when the table column order is modified.但有一些例外,例如:
INSERT INTO table_history
SELECT * FROM table
从表格中得出这样的问题,并将其列入表格。 如果你想在表格和表格中增加新行时继续工作,那么<代码>SlectT*就是前进的道路。
请注意,贵数据库服务器的吨数必然与查询数据库的方案相同。 数据库服务器可以联网,带宽有限,甚至可以在全世界半途。
SELECT * FROM table
.SELECT * FROM table
only to throw half the columns away.具体指明你想要哪一栏:
如@Konerak提到的那样,你想要的栏目命名也确保,即使表格的改动(即插入一栏二)。 如果你根据<条码>第1条Name条码>作为结果的<条码>第(2)/条码>部分重新计算,这一点很重要。
(说明:处理该问题的更有力和自我记录的方法是,请您将数据结果作为关键价值表表,如PHP联阵、Perl hash或A。 这样,你就不必用一定数字来将结果编入索引(
, 姓名 = 成果/代码>——相反,你可以使用栏目:
姓名 = 结果[“FirstName”]
。
使用<代码>SlectT*非常低效率,特别是在有几栏的表格中。 你们只能选择所需要的一栏。
此外,使用一栏名称使查询更容易阅读和维持。
I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
我把我的用心从使用QQL转向MySQL。 它与凯科特合作,现在不工作,因为我已经改变,使用MySQL。 这里的错误信息是:
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...
Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...
What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...
My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...