Yellowpages.com.au By Rosalinda Pritchard. yellowpages.com.au is an Australian business directory. It provides search functions for local or interstate.

Slides:



Advertisements
Similar presentations
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
Advertisements

Implementing an REA Model in a Relational Database
MS Access 2007 IT User Services - University of Delaware.
Database Relationships Objective 5.01 Understand database tables used in business.
Database Relationships Objective 5.01 Understand database tables used in business.
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
With Microsoft Access 2007 Volume 1© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access 2007 Volume 1 Chapter.
Web Application Development. Define ER model in QSEE Generate SQL Create Database mySQL Write Script to use TableEditor class Process to create A simple.
Web Application Development. Tools to create a simple web- editable database QSEE MySQL (or PHPMyAdmin) PHP TableEditor.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
DAY 14: ACCESS CHAPTER 1 Tazin Afrin October 03,
The 2 nd Hand Student Book Database Jon Havier High Distinction Assignment, Autumn 2007.
Learningcomputer.com SQL Server 2008 – Entity Relationships in a Database.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
SQL Server 7.0 Maintaining Referential Integrity.
PLUG IT IN 3 Fundamentals of Relational Database Operations.
1 Intro to JOINs SQL INNER JOIN SQL OUTER JOIN SQL FULL JOIN SQL CROSS JOIN Intro to VIEWs Simple VIEWs Considerations about VIEWs VIEWs as filters ALTER.
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
Access Project 3 Notes. Introduction Maintaining the Database  Modifying the data to keep it up-to-date Restructure the Database  To change the database.
Microsoft Access Intro Class 6 Relationships.
SQL for Data Retrieval. Review Questions of Previous Class Q1. Show the sum of hours worked for project with ID 1200 (use ASSIGNMENT table) – Use “SUM”
5 Copyright © 2004, Oracle. All rights reserved. Creating a Master-Detail Form.
© 2002 by Prentice Hall 1 Database Processing with Microsoft Access David M. Kroenke Database Concepts 1e Appendix A.
Exploring Microsoft Access Chapter 6 Many-to-Many Relationships: A More Complex System.
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
Database Processing with Microsoft Access Appendix DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
Database revision.
ENTITY RELATIONSHIP DIAGRAM ENTITY RELATIONSHIP DIAGRAM IS A SPECIALIZED GRAPHIC THAT ILLUSTRATES THE INTERRELATIONSHIPS BETWEEN ENTITIES IN A DATABASE.
Constraints cis 407 Types of Constraints & Naming Key Constraints Unique Constraints Check Constraints Default Constraints Misc Rules and Defaults Triggers.
Exploring Office Grauer and Barber 1 One-to-Many Relationships: Subforms and Multiple-Table Queries(Wk7)
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
Exploring Microsoft Access Chapter 5 One-to-Many Relationships: Subforms and Multiple Table Queries.
Jenny Jirathammakul High Distinction Assignment Database Principles Autumn, 2007 Melbourne City Toyota.
Chapter 3: Relational Databases
Database Relationships Objective 5.01 Understand database tables used in business.
Teanna Clarke 6aQ What is a Entity-Relationship Diagram?  An Entity-Relationship Diagram (ERD) is a tool that graphically shows the connections among.
Chapter 6 Many-to Many Relationship. Agenda AutoNumber Many-to-many relationship Cascaded updating and deleting Auto Lookup Parameter query Total query.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 2 Objectives: Understanding and Creating Table.
Copyright © 2014 Pearson Canada Inc. Ext. 5b-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5b Using Microsoft Access Part 2: Using Information.
2 Copyright © 2008, Oracle. All rights reserved. Building the Physical Layer of a Repository.
THE DATABASE OF MSY TECHNOLOGY PTY. LTD PRODUCT Ronald Diningrat High Distinction Assignment Autumn 2007.
AOIT Database Design Unit 3, Lesson 9 Data Integrity Copyright © 2009–2011 National Academy Foundation. All rights reserved.
Copyright © 2014 Pearson Canada Inc. 5-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5a Database Design Part 2: Using Information Technology.
Database Relationships
Fundamentals of DBMS Notes-1.
Structured Query Language
Tables & Relationships
SQL Relational Database Project
Databases.
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
Information Systems Today: Managing in the Digital World
Implementing an REA Model in a Relational Database
CIS 155 Table Relationship
Database Concepts Relational Databases Start ….
Implementing an REA Model in a Relational Database
Microsoft Access 2003 Illustrated Complete
Database Systems Instructor Name: Lecture-12.
CIS 336 STUDY Education for Service-- cis336study.com.
Teaching slides Chapter 8.
SQL DATA CONSTRAINTS.
Database Relationships
Creating a Master-Detail Form
Creating and Managing Database Tables
Contents Preface I Introduction Lesson Objectives I-2
Getting Started Chapter One DATABASE CONCEPTS, 5th Edition
Microsoft Access Validation Rules, Table Relationships And
Microsoft Access Date.
Relationships While we are on the subject of Relationships, let’s take a quick look at them.
Presentation transcript:

yellowpages.com.au By Rosalinda Pritchard

yellowpages.com.au is an Australian business directory. It provides search functions for local or interstate businesses. It allows a search for business types such as electricity or business names such as TRU energy. It is a place where businesses can inform the public of their names, contact details and the nature of their business. Database Description

Entity-Relationship Diagram Customer customerID businessPhoneNo businessName businessAddress businessSuburb businessState businessPostCode businessFax contactPerson contactPhoneNo Listing listingID listingPhoneNo listingBusinessName listingBusinessAddress listingBusinessSuburb listingBusinessState listingBusinessPostCode listingBusinessFax listingBusinessUrl listingBusiness Address listingBusinessmobileNo Category catID description listingID* catID* ListingCategory customerID* listingID* CustomerListing m mm m

Single One-to-Many Relationship Listing listingID listingPhoneNo listingBusinessName listingBusinessAddress listingBusinessSuburb listingBusinessState listingBusinessPostCode listingBusinessFax listingBusinessUrl listingBusiness Address listingBusinessmobileNo listingID* catID* ListingCategory 1 m A listing can be listed in one or more category listing. Primary key Foreign key

Single Many-to-Many Relationship Listing listingID listingPhoneNo listingBusinessName listingBusinessAddress listingBusinessSuburb listingBusinessState listingBusinessPostCode listingBusinessFax listingBusinessUrl listingBusiness Address listingBusinessmobileNo Category catID description listingID* catID* ListingCategory 1 1 m m Primary key Foreign key Primary key Foreign key

Single Many-to-Many Relationship A business such as 'Rhodes Docherty & Co' may list this business name under many business categories such as 'Accountants & Auditors', 'Financial Planning', 'Taxation Consultants' and so on. A business category such as 'Accountants & Auditors' can have many businesses listed under its name, businesses that offers accounting and auditing services. So the relationship between listings and categories is that of many-to-many.

A Simple Query Example: Find all Rhodes Docherty ’ s business listing. SQL Query: select * from listing where listingBusinessName like '%Rhodes Docherty%'; Results:

Natural Join Example: Find all Rhodes Docherty ’ s business listing. SQL Query: SELECT listingBusinessName, description FROM listing NATURAL JOIN listingCategory NATURAL JOIN category; Results: listingbusinessname | description Institute of Chartered Accountants In Australia The | Accountants & Auditors Chartered Accountants In Aust The Institute Of | Accountants & Auditors Rhodes Docherty & Co | Accountants & Auditors A J Rhodes Docherty & Co | Financial Planning A J Rhodes Docherty & Co | Taxation Consultants (5 rows)

Cross Product Example: Find all Rhodes Docherty ’ s business listing using cross product method. SQL Query: SELECT listing.listingBusinessName, category.description FROM listing, listingCategory, category WHERE listing.listingID = listingCategory.listingID AND listingCategory. catID = category.catID; Results: listingbusinessname | description Institute of Chartered Accountants In Australia The | Accountants & Auditors Chartered Accountants In Aust The Institute Of | Accountants & Auditors Rhodes Docherty & Co | Accountants & Auditors A J Rhodes Docherty & Co | Financial Planning A J Rhodes Docherty & Co | Taxation Consultants (5 rows)

Group by with HAVING Example: Show all categories that has more than 1 business listings. SQL Query: SELECT description, count(*) FROM category, ListingCategory WHERE category.catID = ListingCategory.catID GROUP BY description HAVING count(*) > 1; Results: description | count Accountants & Auditors | 3 (1 row)

Query with a Sub-Query Example: Show all categories that has no business listings. SQL Query: SELECT description FROM category WHERE catID NOT IN (select catID from ListingCategory); Results: description Vending Equipment & Services Soft Drink Mfrs &/or Distributors Confectionery--Wsalers & Mfrs Take Away Food Hotel, Restaurant & Club Supplies Confectionery--Wsalers & Mfrs Electricity Retailers Electricity Suppliers Gas Suppliers (9 rows)

Self Join Description: Self join allows you to work in a table, joining it to itself. Example: Display all business names or listings that share a phone number. SQL Query: SELECT l1.listingBusinessName, l1.listingPhoneNo, l2.listingBusinessName, l2.listingPhoneNo FROM listing l1, Listing l2 WHERE l1.listingPhoneNo = l2.listingPhoneNo AND l1.listingBusinessName > l2.listingBusinessName; Results: (see next slide)

Self Join Results: listingbusinessname | listingphoneno | listingbusinessname | listingphoneno Institute of Chartered Accountants In Australia The | | Chartered Accountants In Aust The Institute Of | Rhodes Docherty & Co | | A J Rhodes Docherty & Co | (3 rows) The above results shows Rhodes Docherty & Co twice because it has the same phone number as A J Rhodes Docherty & Co which has two entries in the system.

CHECK Statements Example: Validate or check the postcode to ensure it consist of 4 digits. SQL Statement: CREATE TABLE listing (... CONSTRAINT listing_listingBusinessPostCode CHECK ((listingBusinessPostCode >= 1000) AND (listingBusinessPostCode <= 9999)) );

Action Statements Example: Action statements protects data from being corrupted when a user modifies or deletes records from a table. Action Statement 1: CREATE TABLE customerListing (... CONSTRAINT customerListingPK PRIMARY KEY (customerID, listingID), CONSTRAINT customerListingFK_customer FOREIGN KEY (customerID) REFERENCES customer ON DELETE CASCADE, When a record is deleted from customer’s table, the record that is linked to customerListing is automatically deleted, because of the ‘on delete cascade’ action statement.

Action Statements Action Statement 2: CREATE TABLE listingCategory (... CONSTRAINT listingCategoryFK_category FOREIGN KEY (catID) REFERENCES category ON DELETE CASCADE When a record is deleted from the category’s table, the record that is linked to listingCategory is automatically deleted, because of the ‘on delete cascade’ action statement.

View Create View: CREATE VIEW BusListing AS select Customer.customerID, CustomerListing.listingID,listingPhoneNo, listingBusinessName, listingBusinessAddress, listingBusinessSuburb, listingBusinessState, Category.catID, description FROM customer, customerListing, listing, listingCategory, category WHERE customer.customerID = customerListing.customerID AND customerListing.listingID = listing.listingID AND listing.listingID = listingCategory.listingID AND listingCategory.catID = category.catID;

View View BusListing: select listingBusinessName from BusListing; Results: listingbusinessname Institute of Chartered Accountants In Australia The Chartered Accountants In Aust The Institute Of Rhodes Docherty & Co A J Rhodes Docherty & Co A J Rhodes Docherty & Co (5 rows)