# Problems 11–14 are based on the following query: SELECT P_CODE, SUM(LINE_UNITS) FROM LINE GROUP BY P_CODE HAVING SUM(LINE_UNITS) &gt; (SELECT MAX(LINE_UNITS) FROM LINE); Should you create an index on P_CODE? If so, write the SQL command to create the index. If not, explain your reasoning.

### Database Systems: Design, Implemen...

11th Edition
Steven + 8 others
Publisher: Cengage Learning
ISBN: 9781285196145

Chapter
Section

### Database Systems: Design, Implemen...

11th Edition
Steven + 8 others
Publisher: Cengage Learning
ISBN: 9781285196145
Chapter 11, Problem 13P
Textbook Problem
10 views

## Problems 11–14 are based on the following query: SELECT P_CODE, SUM(LINE_UNITS) FROM LINE GROUP BY P_CODE HAVING SUM(LINE_UNITS) > (SELECT MAX(LINE_UNITS) FROM LINE); Should you create an index on P_CODE? If so, write the SQL command to create the index. If not, explain your reasoning.

Program Plan Intro

Indexes:

Indexing is a technique that is used in SQL for optimizing the performance.

• Indexes are used when a small set of rows needs to be selected from the table that is large in size.
• The selection of rows is made by specifying conditions.

Rules for using indexes:

The below are the rules how the indexes can be used

• When an indexed column appears within itself in the search criteria of “WHERE” or “HAVING” clause.
• When an indexed column appears within itself in “GROUP BY” or “ORDER BY” clause.
• When the indexed column is applied with functions MAX and MIN.
• When the indexed column’s data sparsity is high.

Syntax for creating INDEX:

The below mentioned is the syntax for creating the index:

CREATE [UNIQUE]INDEX indexname ON tablename(column1 [, column2])

### Explanation of Solution

Creating an index:

Yes, it is necessary to create an index for the column “P_CODE”.

Reason:

The reason for creating index for the column “P_CODE” will aid in executing the query properly.

• Most of the database create index automatically for the foreign key columns.
• The index can also be manually created using the query...

### Still sussing out bartleby?

Check out a sample textbook solution.

See a sample solution

#### The Solution to Your Study Problems

Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!

Get Started

Find more solutions based on key concepts
What is data independence, and why is it lacking in file systems?

Database Systems: Design, Implementation, & Management

Briefly describe two methods for locating hole positions on the drill press.

Precision Machining Technology (MindTap Course List)

For Problems 16.44 through 16.48, discuss how you would create the solid model of the given objects. See Exampl...

Engineering Fundamentals: An Introduction to Engineering (MindTap Course List)

Game Devices You manage a youth recreation center and have been given a grant to purchase a game console and ac...

Enhanced Discovering Computers 2017 (Shelly Cashman Series) (MindTap Course List)

If your motherboard supports ECC DDR3 memory, can you substitute non-ECC DDR3 memory?

A+ Guide to Hardware (Standalone Book) (MindTap Course List)

What is the purpose of postheating the metal after welding?

Welding: Principles and Applications (MindTap Course List)