a guide to sql, seventh edition
DESCRIPTION
A Guide to SQL, Seventh Edition. Objectives. Introduce Premiere Products, a company whose database is used as the basis for many of the examples throughout the text Introduce Henry Books, a company whose database is used as a case that runs throughout the text - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/1.jpg)
A Guide to SQL, Seventh Edition
![Page 2: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/2.jpg)
Objectives
Introduce Premiere Products, a company whose database is used as the basis for many of the examples throughout the text
Introduce Henry Books, a company whose database is used as a case that runs throughout the text
Introduce Alexamara Marina Group, a company whose database is used as an additional case that runs throughout the text
A Guide to SQL, Seventh Edition
![Page 3: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/3.jpg)
What is a Database?
Database: A structure containing categories of information and relationships between these categories
Categories: sales reps, customers, orders, and parts
Relationships between categories: sales rep to customer and customer to parts ordered
A Guide to SQL, Seventh Edition
![Page 4: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/4.jpg)
The Premier Products Database
Premier Products is a distributor of appliances, housewares, and sporting goods
Manual system no longer feasible for managing customer, order, and inventory data
Database management system will allow for current, accurate data with useful reports
A Guide to SQL, Seventh Edition
![Page 5: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/5.jpg)
Required Data for Sales Reps
Number
Last name
First name
Address
Total commission
Commission rate
A Guide to SQL, Seventh Edition
![Page 6: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/6.jpg)
Required Data for Customer
Customer number
Name
Address
Current balance
Credit limit
Sales rep number
A Guide to SQL, Seventh Edition
![Page 7: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/7.jpg)
Required Data for Parts
Part number
Description
Number of units on hand
Item class
Number of the warehouse where the item is stored
Unit price for each part in inventory
A Guide to SQL, Seventh Edition
![Page 8: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/8.jpg)
A Guide to SQL, Seventh Edition
![Page 9: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/9.jpg)
Components of a Sample Order
Heading (top of the order form)
Order number and date
Customer number, name, address
Sales rep number and name
Body (center of the order form)
One or more order lines or line items
Footer (bottom of the order form)
Order total
A Guide to SQL, Seventh Edition
![Page 10: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/10.jpg)
Components of a Line Item
Part number
Part description
Number of units for the part ordered
Quoted price for the part
Total, or extension, the result of multiplying the number ordered by the quoted price
A Guide to SQL, Seventh Edition
![Page 11: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/11.jpg)
Items Stored for Each Order
Order number
Date of the order
Customer number
Customer name, address and sales rep information are stored with the customer information
Sales rep name is stored with sales rep information
A Guide to SQL, Seventh Edition
![Page 12: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/12.jpg)
Items Stored for Each Order
Order number, part number, number of units ordered
Quoted price
Part description is stored with information on parts
Order total is not stored but is calculated each time order is displayed or printed
A Guide to SQL, Seventh Edition
![Page 13: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/13.jpg)
Sample Rep Table
A Guide to SQL, Seventh Edition
![Page 14: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/14.jpg)
Rep Table Example
Three sales reps in the table identified by number
Sales rep number: 20
Name: Valerie Kaiser
Address: 624 Randall, Grove, FL, 33321
Total commission: $20,542.50
Commission rate: 5% (0.05)
A Guide to SQL, Seventh Edition
![Page 15: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/15.jpg)
Sample Customer Table
A Guide to SQL, Seventh Edition
![Page 16: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/16.jpg)
Customer Table Example
Ten customers are identified by number
Number: 148
Name: Al’s Appliance and Sport
Address: 2837 Greenway, Fillmore, FL, 33336
Current balance: $6,550.00
Credit limit: $7,500.00
Sales rep: 20 (Valerie Kaiser)
A Guide to SQL, Seventh Edition
![Page 17: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/17.jpg)
A Guide to SQL, Seventh Edition
![Page 18: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/18.jpg)
Part Table Example
Ten parts are listed by part number
Part number: AT94
Description: Iron
Units on hand: 50
Item class: HW (housewares)
Warehouse: 3
Price: $24.95
A Guide to SQL, Seventh Edition
![Page 19: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/19.jpg)
Sample Order Table
A Guide to SQL, Seventh Edition
![Page 20: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/20.jpg)
Order Table Example
Seven orders listed by order number
Order number: 21608
Order date: 10/20/2007
Customer: 148 (Al’s Appliance and Sport)
A Guide to SQL, Seventh Edition
![Page 21: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/21.jpg)
Order Line Table Example
Nine order line items listed by order number
Order number: 21608
Part number: AT94 (iron)
Number ordered: 11
Quoted price: $21.95
A Guide to SQL, Seventh Edition
![Page 22: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/22.jpg)
A Guide to SQL, Seventh Edition
![Page 23: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/23.jpg)
Alternate Order Table Example
Displays identical data in one table
Each table row contains all the order lines for each order
Fifth row, order 21617 has two order lines
Part BV06, Qty 2, Quoted price $794.95 each
Part CD52, Qty 4, Quoted price $150.00 each
A Guide to SQL, Seventh Edition
![Page 24: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/24.jpg)
Issues with Alternate Order Table
Difficult to track information between columns
Other issues
How much room is allowed for multiple entries?
What if an order has more order lines than you have allowed room for?
For a given part, how do you determine which orders contain order lines for that part?
A Guide to SQL, Seventh Edition
![Page 25: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/25.jpg)
Benefits of Order Lines Table
Table is less complicated when separated
No multiple entries
Number of order lines is not limited
Finding every order for a given part is simple
A Guide to SQL, Seventh Edition
![Page 26: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/26.jpg)
Henry Books Database
Ray Henry owns Henry Books, a bookstore chain
Data is to be stored in a database
Needs forms and reports to work with the data
Gathers a variety of information on branches, publishers, authors, and books
A Guide to SQL, Seventh Edition
![Page 27: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/27.jpg)
Branch Information
Henry gathers specific information on each branch
Number
Name
Location
Number of employees
A Guide to SQL, Seventh Edition
![Page 28: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/28.jpg)
Publisher Information
Henry gathers specific publisher information
Identifying code
Name
City
A Guide to SQL, Seventh Edition
![Page 29: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/29.jpg)
A Guide to SQL, Seventh Edition
![Page 30: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/30.jpg)
Author Information
Henry gathers specific information for each author
Author number
Last name
First name
A Guide to SQL, Seventh Edition
![Page 31: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/31.jpg)
Book Information
Henry gathers specific information for each book
Book ID code
Title
Publisher
Type of book
Price
Paperback information
A Guide to SQL, Seventh Edition
![Page 32: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/32.jpg)
A Guide to SQL, Seventh Edition
![Page 33: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/33.jpg)
Additional Information
Henry gathers specific information in the WROTE table
Book code
Author number
Sequence, for books with multiple authors
This table relates books and authors
A Guide to SQL, Seventh Edition
![Page 34: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/34.jpg)
Inventory Information
Henry gathers specific information in the INVENTORY table
Book code
Branch number
On hand quantity
This table indicates the number of copies currently on hand at a particular branch
A Guide to SQL, Seventh Edition
![Page 35: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/35.jpg)
A Guide to SQL, Seventh Edition
![Page 36: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/36.jpg)
Alexamara Marina Database
Alexamara Marina Group offers in-water storage to boat owners
Has two properties
Also provides boat repair and maintenance services
Uses database to store information for managing operations
A Guide to SQL, Seventh Edition
![Page 37: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/37.jpg)
Marina Information
MARINA table stores data on the two marinas
Marina number
Name
Street Address
City, State, and Zip
A Guide to SQL, Seventh Edition
![Page 38: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/38.jpg)
Boat Owner Information
The marina also stores information on the boat owners in the OWNERS table
Owner number
Last and First names
Street Address
City, State, and Zip
A Guide to SQL, Seventh Edition
![Page 39: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/39.jpg)
Slip Information
Information on the slips in each marina is stored in the MARINA_SLIP table
Slip ID, Marina Number, Slip Number
Length
Rental fee
Boat name and Boat type
Owner number
A Guide to SQL, Seventh Edition
![Page 40: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/40.jpg)
A Guide to SQL, Seventh Edition
![Page 41: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/41.jpg)
Service Information
Maintenance service category information is stored in the SERVICE_CATEGORY table
Information on the services requested is stored in the SERVICE_REQUEST table
Stores service category, slip information, description and status, estimated hours, hours spent, and next service date
A Guide to SQL, Seventh Edition
![Page 42: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/42.jpg)
A Guide to SQL, Seventh Edition
![Page 43: A Guide to SQL, Seventh Edition](https://reader036.vdocument.in/reader036/viewer/2022062422/56813aef550346895da3633a/html5/thumbnails/43.jpg)
Summary
Premiere Products
Require rep, customer, parts, orders and order lines information
Henry Books
Requires branch, publisher, author, book, inventory and author sequence information
Alexamara Marina Group
Requires marina, owners, slips, service categories and service request information
A Guide to SQL, Seventh Edition