Summarize the steps required to formulate a query

Queries are usually written to answer questions. In order to formulate a query, the following steps are used.

a) Identify what columns and computations are required:
The first step is needed to determine those required data values that are to be returned. For example, one must determine if names and addresses alone need to be returned or is there a need to include computations as well while returning the output. Another important note in the first step is that the columns in the SELECT statement should return single values.

b) Identify the source tables:
Once the required columns are identified, the source tables used in the query can be determined. If certain attributes appear in more than one table try to use the least number of tables in the query to minimize the number of join operations.

c) Determine how to join the tables:
Once the tables needed in the query statement are determined, one needs to properly identify how to join the tables. In most cases, a natural join is used, but occasionally an outer join is used.

d) Determine what selection criteria is used:
Most queries involve some type of selection criteria. In this case, the operators and operands that are needed by the criteria are determined. The correct data type and the granularity of data in the comparison of criteria need to be ensured.

e) Determine the order in which to display the output:
In the final stage, the required output might be ordered by one or more columns. The ORDER BY clause is particularly used to order the required output in this way but is a very resource-intensive operation for the DBMS.

Business

You might also like to view...

The mathematical theory behind linear programming states that an optimal solution to any problem will lie at a(n) ________ of the feasible region

A) interior point or center B) maximum point or minimum point C) corner point or extreme point D) interior point or extreme point E) None of the above

Business

Accounts payable is considered a

A) spontaneous liability. B) temporary financing source. C) permanent financing source. D) both A and B.

Business