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...

Lawrence believes there can be synergistic effects between intrinsic and extrinsic motivation. In order to test this out, he gives his employees 25% of their work time to work on projects they are passionate about, even if it falls outside the scope of their job or is unrelated to the mission of the company. Lawrence is using which of the following psychological mechanisms?

A. social learning theory B. motivation-work cycle match C. extrinsics in service of intrinsics D. intrinsics in service of extrinsics

Business

Which of the following most exemplifies the value-added principle?

A. A competitive management program that emphasizes quality B. Information gathering and reporting activities should be restricted to those activities that add value in excess of their cost C. Managerial accounting information is measured in economic, physical, and financial terms D. An ongoing process where continuous improvement is the goal

Business

What is the difference between brainstorming and mind mapping?

Business

What is the average time a customer spends in the line waiting to be served?

In a bank drive-through, there is a single service window and room only for two cars to line-up to wait for service. The mean time between arrivals for drive through customers is 5 minutes. The mean time to complete a customer transaction is 3 minutes. The number of arrivals is distributed according to a Poisson distribution and the service times are exponentially distributed.

Business