Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL PROGRAMMING AND THE EXTERNAL MODEL Fact of the Week: According to the 2010 outlook from the BLS 286,600 new Computer, Network, and Database administrator.

Similar presentations


Presentation on theme: "SQL PROGRAMMING AND THE EXTERNAL MODEL Fact of the Week: According to the 2010 outlook from the BLS 286,600 new Computer, Network, and Database administrator."— Presentation transcript:

1 SQL PROGRAMMING AND THE EXTERNAL MODEL Fact of the Week: According to the 2010 outlook from the BLS 286,600 new Computer, Network, and Database administrator jobs will be added in the next decade.

2 Learning Objectives  Understand the rationale and purpose of SQL programming  Understand and explain the external data model  Learn how to create views, stored procedures, and functions  Learn how to perform program flow control in T- SQL

3 Where are we?

4 Internal –vs- External Data Models  Optimal design for storing data  Complex & atomic in nature  Implemented with Tables, keys, constraints  Mimics user functionality  Abstracted & simplified in nature  Implemented with views, stored procedures, functions INTERNALEXTERNAL

5 Let’s explore the external data model and T-SQL programming by example. Fudge Fictitious Credit Union

6 Basic Data Model (Internal Model)

7 FFCU – Uber-Simplified User Stories 1. When a person signs up, then they become a new customer. All new customers have an opening balance in their savings account. 2. A customer can deposit funds into their account. 3. A customer can withdrawal funds from their account 4. A customer can have view balances their 2 types of accounts, Checking and Savings 5. A customer can transfer funds between their accounts. (checking to savings and vice-versa)

8 External Model  p_signup – sign a user up for an account  p_deposit – deposit funds into user’s account  p_withdrawl – take out funds from a user’s account  p_transfer – transfer funds from one user account to another  v_myaccounts – show balances for the user’s account

9 p_signup  INSERT INTO Customers...  INSERT INTO Accounts…  (Savings with initial starting amount)  INSERT INTO Accounts…  (Checking)

10 p_transfer  UPDATE Accounts…  (Remove amount from account)  UPDATE Accounts…  (Add amount to account)

11 v_myaccounts  Show detailed account information for Customer, Account(s), and Type(s) of Accounts.


Download ppt "SQL PROGRAMMING AND THE EXTERNAL MODEL Fact of the Week: According to the 2010 outlook from the BLS 286,600 new Computer, Network, and Database administrator."

Similar presentations


Ads by Google