Download database - Stefano Grazioli

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft Jet Database Engine wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Database wikipedia , lookup

Clusterpoint wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Database model wikipedia , lookup

PL/SQL wikipedia , lookup

Relational model wikipedia , lookup

SQL wikipedia , lookup

Transcript
Financial Information Management
Databases
Stefano Grazioli
Debriefing
 Still doing well
 Timing your posts
 Easy meter
You do the talking





Name, major
Learning objectives
Things you like about the class
Things that can be improved
Strengths / Attitude towards the
Tournament
Financial Information Management
Databases
Stefano Grazioli
Why do we need Databases?
 Program (e.g., VBA) data is volatile
 Data in one place for everyone to use
 Indispensable in commerce
DBs vs. DBMSs


A database (DB) is an organized collection of data
A DataBase Management System (DBMS) is a software that
provides data-related functionality
User location
User or
User or
program
‘Client’
program
program
Data center
DBMS
DBMS: Access, Oracle, IBM DB2, SQL Server, MySQL...
DBs and the Web
User location
User or
User or
program
Browser
program
program
Data center
Web
server
DBMS
Relational DBMS
When a DBMS organizes your data so that they
appear to the users as TABLES, that DBMS is a
Relational DBMS, or RDBMS.
I speak
SQL
Client
program
I speak
SQL
RDBMS
Financial Information Management
WINIT
What Is New
In Technology?
Financial Information Management
Congratulations!
You are hired at SmallBank
Homework
You are a Business Intelligence
analyst at SmallBank
Welcome! So glad that you are here and can help us with Business
Intelligence! I have so many business questions for you…
(1) Who are our customers in Austin, TX? I need a list of first names,
last names and IDs
(2) What are the rates that we offered on our loans? Prepare a report
with the loan IDs and rates for the loans under $50,000,000
(3) ….
Please access our MS SQL Server and create these reports for me…
Accessing Business Data
User location
SQL Client
Visual Studio
Sql queries
Data center
RDBMS
MS SQL Server
F-sg6m-s4
SmallBank data:
Loan, Loan
Officer,
Customer,
Insurance Plan
A file on the server
Example Table: Loan Officer
ACTUAL TABLE
DIAGRAM
LO id
f name
l name
phone
demo
Small Bank DB: Data Dictionary
 Loan
 l_id = the loan unique id
 principal, rate, date_due,
 Loan officer
 lo_id = the loan officer’s unique id
 f_name, l_name, phone
 Customer
 c_id = the customer’s unique id
 f_name, l_name, city, state
 Insurance plan
 coverage = maximum amount covered
 premium = amount to pay every year
Reading the Data Model
Primary key: a unique
identifier used to
retrieve the record
Reading the Relationships
1
6
“A loan officer has
many loans, a loan
has one loan officer”
One
5
2
3
Many
4
Financial Information Management
SQL Queries
SQL



Structured Query Language
The standard language for databases
70s:
- Codd
- SEQUEL – Structured English QUEry Language



commercialized it in 1979
1986 ISO/ANSI
Sometimes sought as a required skill in interviews
SQL EXAMPLE: A QUERY
SELECT First_Name, Last_Name,
ssn
FROM StudentTbl
WHERE gpa > 3.0
ORDER BY Last_Name;
4+2 BASIC SQL COMMANDS




SELECT = ‘search’
INSERT a new row
UPDATE a existing row
DELETE a row
 CREATE a table
 DROP a table
Navigating the Relationships (‘join’)
FK
foreign key: a PK in
another table, used
to link the two tables
FK
FK
FK
FK
Joins are commonsense
If I give you c_id ‘4977’,
can you give me the
phone numbers of the
loan officers for that
client?
SQL Query
Select loan_officer.phone
from customer_in_loan, loan, loan_officer
where
customer_in_loan.c_id = '4977' and
customer_in_loan.l_id = loan.l_id and
loan.lo_id = loan_officer.lo_id
If I give you c_id ‘4977’, can
you give me the phone
numbers of the loan officers
for that client?