什么是临时查询? [英] What is Ad Hoc Query?
问题描述
我正在读一本有关SQL的书.那本书里有 Ad Hoc Query 这个词,我听不懂.
I'm reading a book about SQL. In that book there's the term Ad Hoc Query, which I don't understand.
什么是临时查询?
推荐答案
即席是拉丁文,用于为此目的".您可以将其称为即时"查询或正好如此"查询.这种SQL查询只是您在需要的地方轻松键入
Ad hoc is latin for "for this purpose". You might call it an "on the fly" query, or a "just so" query. It's the kind of SQL query you just loosely type out where you need it
var newSqlQuery = "SELECT * FROM table WHERE id = " + myId;
...,这是每次执行代码行时完全不同的查询,具体取决于myId
的值.临时查询的对立面是预定义查询,例如存储过程,在该查询中,您创建了一个查询以用于从该表中进行选择的整个通用目的(例如),并将ID作为变量传递.
...which is an entirely different query each time that line of code is executed, depending on the value of myId
. The opposite of an ad hoc query is a predefined query such as a Stored Procedure, where you have created a single query for the entire generalized purpose of selecting from that table (say), and pass the ID as a variable.
这篇关于什么是临时查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!