Database Processing Fundamentals Design and Implementation 15th Edition Kroenke Solutions Manual Download
Database Processing Fundamentals Design and Implementation 15th Edition Kroenke Solutions Manual Download
https://testbankdeal.com/product/database-processing-
fundamentals-design-and-implementation-15th-edition-kroenke-
solutions-manual/
https://testbankdeal.com/product/database-processing-fundamentals-
design-and-implementation-15th-edition-kroenke-test-bank/
https://testbankdeal.com/product/database-processing-fundamentals-
design-and-implementation-13th-edition-kroenke-solutions-manual/
https://testbankdeal.com/product/database-processing-fundamentals-
design-and-implementation-14th-edition-kroenke-solutions-manual/
https://testbankdeal.com/product/shelly-cashman-series-microsoft-
office-365-and-word-2016-introductory-1st-edition-vermaat-solutions-
manual/
Managerial Accounting Tools for Business Decision Making
Canadian 4th Edition Weygandt Test Bank
https://testbankdeal.com/product/managerial-accounting-tools-for-
business-decision-making-canadian-4th-edition-weygandt-test-bank/
https://testbankdeal.com/product/biology-science-for-life-5th-edition-
belk-test-bank/
https://testbankdeal.com/product/starting-out-with-visual-basic-7th-
edition-gaddis-solutions-manual/
https://testbankdeal.com/product/business-research-methods-12th-
edition-cooper-test-bank/
https://testbankdeal.com/product/calculus-11th-edition-larson-test-
bank/
Pharmacotherapeutics for Nurse Practitioner Prescribers
3rd Edition Moser Woo Test Bank
https://testbankdeal.com/product/pharmacotherapeutics-for-nurse-
practitioner-prescribers-3rd-edition-moser-woo-test-bank/
INSTRUCTOR’S MANUAL
TO ACCOMPANY
Chapter 7
SQL for Database Construction and Application Processing
Prepared By
David J. Auer
Western Washington University
Instructor's Manual to accompany:
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior
written permission of the publisher. Printed in the United States of America.
Chapter Seven – SQL For Database Construction and Application Processing
❖ CHAPTER OBJECTIVES
• To be able to create and manage table structures using SQL statements
• To understand how referential integrity actions are implemented in SQL statements
• To be able to create and execute SQL constraints
• To understand several uses for SQL views
• To be able to use SQL statements to create, use, and manage views
• To gain an understanding of how SQL is used in an application program
• To understand how to create and use functions
• To understand how to create and use triggers
• To understand how to create and use stored procedures
Page 7-3
Copyright © 2019Pearson Education, Inc.
Chapter Seven – SQL For Database Construction and Application Processing
❖ ERRATA
[05-MAY-2018 – David Auer] Page 412. The Queen Ann Curiosity Shop Project
Question M has a misspelled word. The corrected question text is:
Write an SQL statement to create a view called EmployeeSupervisorView that shows who, if anyone,
supervises each employee at The Queen Anne Curiosity Shop, and which contains E1.LastName as
EmployeeLastName, E1.FirstName as EmployeeFirstName, E1.Position, E2.Lastname as
SupervisorLastName, and E2.FirstName as SupervisorFirstName. E1 and E2 are two aliases for the
EMPLOYEE table, and are required to run a query on a recursive relationship. Include employees
who do not have a supervisor. Run the statement to create the view, and then test the view with an
appropriate SQL SELECT statement.
[05-MAY-2018 – Scott Vandenberg] Page 416. There is an error in the list of values for
the STORE.Country column. Based on Figure 7-61, possible values should include the
People’s Republic of China, but not Hong Kong because Hong Kong is now part of the
People’s Republic of China. The corrected question text is:
Values of the Country column in the STORE table are restricted to: India, Japan, People’s Republic of
China, Peru, Philippines, Singapore, and United States.
[05-MAY-2018 – David Auer] Page 412. The Queen Ann Curiosity Shop Project
Question M has a misspelled word. The corrected question text is:
Write an SQL statement to create a view called EmployeeSupervisorView that shows who, if anyone,
supervises each employee at The Queen Anne Curiosity Shop, and which contains E1.LastName as
EmployeeLastName, E1.FirstName as EmployeeFirstName, E1.Position, E2.Lastname as
SupervisorLastName, and E2.FirstName as SupervisorFirstName. E1 and E2 are two aliases for the
EMPLOYEE table, and are required to run a query on a recursive relationship. Include employees
who do not have a supervisor. Run the statement to create the view, and then test the view with an
appropriate SQL SELECT statement.
[06-MAY-2018 – Bob Yoder] Page 412. The Queen Ann Curiosity Shop Project
Question Q has an incorrect SQL view name. The corrected question text is:
Write an SQL statement to create a view called CustomerFirstNameFirstSaleSummaryView that
contains SALE.SaleID, SALE.SaleDate, CUSTOMER.CustomerID, the concatenated customer name
using the FirstNameFirst function, SALE_ITEM .SaleItemID, SALE_ITEM.ItemID,
ITEM.ItemDescription, and ITEM.ItemPrice. Run the statement to create the view, and then test the
view with an appropriate SQL SELECT statement.
Page 7-4
Copyright © 2019Pearson Education, Inc.
Chapter Seven – SQL For Database Construction and Application Processing
❖ TEACHING SUGGESTIONS
• If your students have been using Access, now is really the time to switch to Microsoft
SQL Server 2017, Oracle Database, or MySQL 5.7. Refer your students to the
beginning of Online Chapter 10A for Microsoft SQL Server 2017, Online Chapter 10B
for Oracle Database (Oracle Database Express Edition 11g Release 2, aka Oracle
Database XE is heavily recommended), and Online Chapter 10C for MySQL 5.7
setup instructions.
• The SQL examples shown in Chapter 7 and the questions in the end of chapter
material work the best with the Transact-SQL (T-SQL) used in Microsoft SQL Server
2017. If your students are using Microsoft SQL Server 2017, they should be able to
create the tables, populate the tables and run the other SQL commands with little
trouble. The SQL used in Microsoft Access 2016, Oracle Database (PL/SQL), and
MySQL 5.7 varies in their ability to support all the SQL commands used here.
Oracle Database and MySQL do a better job of supporting standard SQL, while
Microsoft Access has significant variations from the standard. In the answers to the
end of chapter questions I have often shown the solution using two or more of the
three DBMSs. Otherwise, I primarily use Microsoft SQL Server 2017. If your
students are using Microsoft Access 2016, Oracle Database, or MySQL 5.7 check
the solutions to the questions before you assign them so that you can tell your
students what to watch out for!
• As discussed in the IM Chapter 2 suggestions, there is a useful teaching technique
that will allow you to demonstrate the SQL queries in the text using MS SQL Server if
you have it available.
• Create a new SQL Server database named Cape-Codd.
• Use the SQL statements in the *.sql text file DBP-e15-MSSQL-Cape-Codd-
Create-Tables.sql to create the Cape Codd database tables (the additional
tables used in the Chapter 2 Review Questions, are also created).
• Use the SQL statements in the *.sql text file DBP-e15-MSSQL-Cape-Codd-
Insert-Data.sql to populate the Cape Codd tables (the additional tables used
in the Chapter 2 Review Questions, are also populated).
• Open the Microsoft SQL Server Management Studio and select the Cape-
Codd database.
• In the Microsoft SQL Server Management Studio, open the *.sql text file DBP-
e15-MSSQL-Cape-Codd-Query-Set-CH02.sql. This file contains all the
queries shown in the Chapter 2 text.
• Highlight the query you want to run, and then click the Execute Query button
to display the results of the query. An example of this is shown in the
following screenshot.
• All of the *.sql text files needed to do this are available in the Instructor’s
Resource Center on the text’s Web site
(www.pearsonhighered.com/kroenke).
Page 7-5
Copyright © 2019Pearson Education, Inc.
Chapter Seven – SQL For Database Construction and Application Processing
• The trick shown for SQL Server 2017 also works for Oracle Database using the
Oracle SQL Developer and for MySQL 5.7 using the MySQL workbench.
• Remind your students that Microsoft Access does not support all SQL constructs.
• Because of the complexity of the SQL statements to construct the View Ridge
Gallery VRG database, the necessary SQL scripts are included in the set of student
data files available at the text’s Web site (www.pearsonhighered.com/kroenke).
• Review Questions 7.04-7.40 are specifically designed to reinforce the most important
basic ideas of creating and populating tables, with a bit on SQL views also included.
These exercises are based on our recent classroom teaching experience, which
taught us the need for some very basic exercises in creating and populating tables
before going on to more complex assignments. This set of exercises is very heavily
recommended!
• Tell your students that a check constraint that provides an enumerated list is often
implemented with a table and a relationship. For example, the constraint CHECK
(Rank IN (‘FR’, ‘SO’, ‘JR’, ‘SR’)) could be implemented by creating a Rank table and
placing the list in that table. Now the Rank attribute becomes a foreign key and
referential integrity enforces the constraint. Changing the list means adding and
deleting from the RANK table.
• The relationship of database applications and the DBMS is sometimes confusing.
For a simple application using a personal DBMS such as Microsoft Access, the
application and the DBMS are nearly indistinguishable. If an application has only a
few forms and reports, and all of these are created using DBMS facilities, then the
application and the DBMS are the same. On the other hand, for an organizational
database processed by say, Oracle Database, any application elements discussed in
this chapter would be provided by application program code completely separate
Page 7-6
Copyright © 2019Pearson Education, Inc.
Chapter Seven – SQL For Database Construction and Application Processing
from the DBMS. It’s easier to understand all of this by focusing on application
functions that must be provided — in some cases by facilities in the DBMS and in
other cases by separate application programs.
• It is important to distinguish between an SQL view (the logical structure of data
elements) and a materialization of the view (a form or report). One SQL view can
have many materializations. While this distinction has always been important, it has
become even more so in light of three-tier architecture.
• Remind students that views can be used to implement certain types of security. Most
commonly, they are used to restrict access to attributes and to restrict actions on
tables. This is discussed in detail in Chapter 9.
• You might also remind students that sometimes SQL views are necessary to
complete certain queries.
• Too often students understand how SQL can be used for interactive query, but do
not really understand its role in application processing. In fact, SQL is far more
frequently used for SQL view processing as described here than it is as an
interactive query tool.
• SQL/Persistent Stored Modules (SQL/PSM), stored procedures and triggers
complete a student’s understanding of how database systems work. Often, we talk
about designing database systems to enforce business rules but find many rules that
we cannot enforce through design alone. Triggers will help enforce most rules that
design cannot enforce.
• SQL *sql files containing the solutions to the questions and projects at the end of the
chapter are available on the text’s Web site (www.pearsonhighered.com/kroenke).
Page 7-7
Copyright © 2019Pearson Education, Inc.
Chapter Seven – SQL For Database Construction and Application Processing
• CREATE TABLE
• ALTER TABLE
• DROP TABLE
• TRUNCATE TABLE
7.2 What does DML stand for? List the SQL DML statements.
• INSERT
• UPDATE
• DELETE
• MERGE
7.3 Explain the meaning of the following expression: IDENTITY (4000, 5).
The IDENTITY keyword is used to modify a column name, and is used to specify surrogate keys.
The first number parameter after IDENTITY specifies the starting value for the surrogate key,
and the second number specifies the increment value for each additional record. Thus a column
named RelationID and modified by IDENTITY (4000, 5) will be a surrogate key named
RelationID with an initial value of 4000 (for the first record in the relation), and with following
values incremented by 5: 4000, 4005, 4010, etc.
Page 7-8
Copyright © 2019Pearson Education, Inc.
Chapter Seven – SQL For Database Construction and Application Processing
For this set of Review Questions, we will create and use a database with a set of tables that will
allow us to compare variations in SQL CREATE TABLE and SQL INSERT statements. The
purpose of these questions is to illustrate different situations that call for specific uses of various
SQL CREATE TABLE and SQL INSERT options.
The database will be named CH07_RQ_TABLES and will contain the following six tables:
EmailAddress is a text column containing an email address, and is therefore not a surrogate
key. CustomerID is a surrogate key that starts at 1 and increments by 1. SaleID is a surrogate
key that starts at 20150001 and increases by 1.
The column characteristics for these tables are shown in Figures 7-35 (CUSTOMER_01), 7-36
(CUSTOMER_02, CUSTOMER_03, and CUSTOMER_04), 7-37 (SALE_01), and 7-38
(SALE_02). The data for these tables are shown in Figures 7-39 (CUSTOMER_01), 7-40
(CUSTOMER_02), 7-41 (CUSTOMER_04), 7-42 (SALE_01), and 7-43 (SALE_02).
7.4 If you are using Microsoft SQL Server, Oracle Database, or MySQL, create a folder in
your Documents folder to save and store the *.sql scripts containing the SQL statements
that you are asked to create in the following Review Questions about the
CH07_RQ_TABLES database.
Page 7-9
Copyright © 2019Pearson Education, Inc.
Chapter Seven – SQL For Database Construction and Application Processing
• If you are using Microsoft Access 2016, create a folder named CH07-Databases
in your DBPe15-Access-2016-Databases folder.
This is self-explanatory. The student will create the appropriate folder to hold the *.sql scripts
created in these Review Questions
This is self-explanatory. The student will create the appropriate database base upon which DBMS
product they are using. For further guidance on creating a new database:
7.6 If you are using Microsoft SQL Server, Oracle Database, or MySQL, create and save an
SQL script named CH07-RQ-TABLES-Tables-Data-and-Views.sql to hold the answers to
Review Questions 7.7–7.40. Use SQL script commenting (/* and */ symbols) to write
your answers to Review Questions that require written answers as comments.
If you are running Microsoft Access 2016, create and save a Microsoft Notepad text file
named CH07-RQ-TABLES-Tables-Data-and-Views.txt to hold the answers to Review
Questions 7.7–7.40. After you run each SQL statement in Microsoft Access 2016, copy
your SQL statement to this file.
This is self-explanatory. The student will create an *.sql script named CH07-RQ-TABLES-
Tables-Data-and-Views.sql, unless the student is using Microsoft Access 2016 (which they really
shouldn’t be at this point!), in which case they will create a text file named CH07-RQ-TABLES-
Tables-Data-and-Views.txt to hold certain answers.
7.7 Write and run an SQL CREATE TABLE statement to create the CUSTOMER_01 table.
Page 7-10
Copyright © 2019Pearson Education, Inc.
Visit https://testbankdead.com
now to explore a rich
collection of testbank,
solution manual and enjoy
exciting offers!
Chapter Seven – SQL For Database Construction and Application Processing
7.8 Write and run an SQL CREATE TABLE statement to create the CUSTOMER_02 table.
Page 7-11
Copyright © 2019Pearson Education, Inc.
Chapter Seven – SQL For Database Construction and Application Processing
7.9 Are there any significant differences between the CUSTOMER_01 and CUSTOMER_02
tables? If so, what are they?
7.10 Write and run an SQL CREATE TABLE statement to create the CUSTOMER_03 table.
Page 7-12
Copyright © 2019Pearson Education, Inc.
Chapter Seven – SQL For Database Construction and Application Processing
7.11 Are there any significant differences between the CUSTOMER_02 and CUSTOMER_03
tables? If so, what are they?
The table structure is the same, so there are no significant differences between the
CUSTOMER_02 and CUSTOMER_03 tables.
7.12 Write and run an SQL CREATE TABLE statement to create the CUSTOMER_04 table.
Page 7-13
Copyright © 2019Pearson Education, Inc.
Chapter Seven – SQL For Database Construction and Application Processing
7.13 Are there any significant differences between the CUSTOMER_03 and CUSTOMER_04
tables? If so, what are they?
The table structure is the same, so there are no significant differences between the
CUSTOMER_03 and CUSTOMER_04 tables.
7.14 Write and run an SQL CREATE TABLE statement to create the SALE_01 table. Note
that the foreign key is EmailAddress, which references CUSTOMER_01. EmailAddress.
In this database, CUSTOMER_01 and SALE_01 records are never deleted, so that there
will be no ON DELETE referential integrity action. However, you will need to decide how
to implement the ON UPDATE referential integrity action.
Page 7-14
Copyright © 2019Pearson Education, Inc.
Chapter Seven – SQL For Database Construction and Application Processing
);
CREATE TABLE SALE_01(
SaleID INT NOT NULL AUTO_INCREMENT,
DateOfSale DATE NOT NULL,
EmailAddress VARCHAR(100) NOT NULL,
SaleAmount NUMERIC(7,2) NOT NULL,
CONSTRAINT SALE_PK_01 PRIMARY KEY(SaleID),
CONSTRAINT S_01_C_01_FK FOREIGN KEY(EmailAddress)
REFERENCES CUSTOMER_01(EmailAddress)
ON UPDATE CASCADE
);
7.15 In Review Question 7.14, how did you implement the ON UPDATE referential integrity
action? Why?
The ON UPDATE referential integrity action is implemented as CASADE. This is because the
primary key of CUSTOMER_01 (EmailAddress) is not a surrogate key, and may therefore be
changed. Any changes to EmailAdress in CUSTOMER_01 must also be made to corresponding
values in SALE_01.
Page 7-15
Copyright © 2019Pearson Education, Inc.
Random documents with unrelated
content Scribd suggests to you:
was elected to the House of Assembly of P.E.I., by the electors of the
4th electoral district of Prince county; again at the general election in
1882, and again in 1886, he was each time returned at the head of
the poll. In January, 1887, he was appointed a member of the
Executive Council, and in the following month was chosen
commissioner of Public Works. This appointment necessitated
another appeal to the electors, and he was again returned in spite of
determined opposition. Mr. Bentley has been a life-long advocate of
temperance, and has for the last twenty-five years been connected
with the order of the Sons of Temperance. He has held the office of
grand worthy patriarch of the Grand Division of Prince Edward
Island, and is now a member of the National Division of the Sons of
Temperance of North America. He has travelled through all the
provinces of British North America, and many of the states of the
neighbouring republic. Politically Mr. Bentley belongs to the ranks of
the Conservative party; and in religious matters he is an adherent of
the Methodist church. On the 9th February, 1870, he was married to
Emma Jane, daughter of William Dennis, of Margate, P.E.I.
That the union of the British North American provinces on just principles,
while calculated to perpetuate their connection with the parent state, would
promote their advancement and prosperity, increase their strength and
influence, and elevate their position.
And though before the union was consummated he had retired from
public life, and was therefore in no way responsible for the details of
the scheme, yet his advocacy of the measure on its broad basis
tended in no slight degree to create and educate public opinion, and
smoothed the way for those who eventually succeeded in effecting
the important change in the constitution he was the first to
advocate. In the year 1857 Hon. Mr. Johnston, then attorney-general
and leader of the government, pursuant to a resolution passed in the
House of Assembly, proceeded to England to adjust the differences
that for years existed between the province and the General Mining
Association, who, as assignees of the Duke of York, to whom they
had been granted, claimed the exclusive right to the mines and
minerals of Nova Scotia, and who, by virtue thereof, possessed a
practical monopoly of the coal trade. After a protracted negotiation,
a compromise was effected and an agreement entered into by which
the General Mining Association ceded to the government all their
right and title to, and over, all the unworked mines and minerals.
Thus was a grievance of long standing amicably settled, and their
right to the great wealth hidden in the bowels of the earth secured
to the people of Nova Scotia. In the year 1863, after a labourious
and active professional life, and a somewhat turbulent political
career, Hon. Mr. Johnston accepted a seat on the bench as judge in
Equity and judge of the Supreme Court. The duties of his office were
discharged with assiduity and the strictest integrity, and his decisions
were received by the bar as clear, logical, and exhaustive expositions
of the law. In the summer of 1872, Hon. Mr. Johnston obtained leave
of absence, and proceeded to the south of France in the hopes that
a milder and more genial climate might remove a bronchial affection
from which he was suffering, but the beneficial results anticipated
did not follow. He was offered in the following year the lieutenant-
governorship of his adopted country, vacant by the demise of the
late Hon. Joseph Howe, but this position the state of his health
compelled him to decline. Early in life Mr. Johnston connected
himself with the Baptist Church, and to the end continued a member
of that communion. For years he devoted his time, energies and
talents to the advancement of that body, socially, politically and
educationally. The Baptist Academy at Wolfville, as well as Acadia
College, owe their existence in a large measure to his personal
labours, influence, and untiring exertions both in parliament and out.
Of the latter institution he was one of the first governors, and
continued to hold the office uninterruptedly, by repeated re-
elections, to the time of his death. He was several times elected
president of the Baptist Convention of the Maritime provinces, who,
on his leaving the country, marked their great appreciation of his
character and their sense of their lasting obligations to him by the
unanimous adoption of the following resolution: —
This convention, having learnt that the health of our esteemed brother,
Hon. Judge Johnston, a member of the Board of Governors of Acadia
College, has induced him to seek a residence in Europe, Therefore resolve
that we take this opportunity to tender to him the tribute which his high
character, and long continued and important services in the cause of
education seem to demand, by thus recording the sense we entertain of the
value of those services, his devoted and consecrated talents, and of his great
worth as a man, as a Christian gentleman, and especially as a Christian
legislator and judge, the influence and grateful memory of which we trust
will not be effaced; and although at his advanced age it may almost seem to
be hoping against hope, yet this convention would still trust that a perfect
restoration to health and strength may yet, in the good providence of God,
return our valued brother, as well as his excellent lady, to their former
position and relations in this country.
Hon. Mr. Johnston was twice married. His first wife was Amelia
Elizabeth, daughter of the late William James Almon, surgeon, who
was assistant surgeon to the Royal Artillery in New York, in June,
1776, and Rebecca Byles, granddaughter of the Rev. Dr. Byles, of
Boston, Massachusetts. By her he had three sons, the eldest of
whom is now the judge of the County Court for the metropolitan city
and county of Halifax, and three daughters. Of these, two sons and
one daughter are alive. His second wife was Louise, widow of the
late Captain Wentworth, of the Royal Artillery, by whom he had one
daughter and three sons; the daughter and two sons are living. Mr.
Johnston’s physicians advised that his state of health would not
permit of his return to Nova Scotia, and he determined to pass the
winter of 1873 at Cheltenham, England, where, on the 21st day of
November, in that year, at the ripe age of eighty-one years, and in
the full possession of his mental faculties, he died, full of honours,
leaving behind him a name untarnished, a character above reproach,
and a reputation as a statesman, jurist and judge worthy of
emulation by those who shall hereafter fill the places vacated by
him.
testbankdeal.com