Download Class Notes

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

Oracle Database wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Database wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Functional Database Model wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Open Database Connectivity wikipedia , lookup

SQL wikipedia , lookup

PL/SQL wikipedia , lookup

Clusterpoint wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Welcome!
DBT544 students
to the
iSeries,
DB2 Universal Database
And SQL interface
1
Agenda
• Administrivia
• DB2 Basics
2
Some Administrivia
Course Standards
3
Course Structure
• 2 hours of lecture
• 2 hours of labs
– The purpose of the labs is to practice and
expand on what you learned in the lecture and
studied in the text book.
– provide you with actual practical problems as
they occur in the industry.
– It is the hands-on, practical side of the course.
Attendance and completion of the labs will be
a key factor in completing the course
successfully.
• Remember PRACTISE makes PERFECT
4
Lecture and Lab Notes
• Lecture notes will be available from my Home Page or handed
out.
• Labs can be retrieved from DBT544/HANDOUTF05 on ODIN
before or during the lab or provided as a handout.
• Please print the lecture or lab notes, when appropriate, ahead of
time and bring them to class.
• !! Each lab will have a “deliverable” associated with it and will
be evaluated for marks to be counted towards your final grade!!
5
Do you want to do well?
•
•
•
•
Show up for Lectures
Complete the Labs, MARKS!
Do the required reading
Do the Review questions and labs from
your text book, they serve both to reenforce and as practice
6
Marks
• TEST 1
• Final Exam
• Labs
35%
35%
30%
• 6 labs - 5% each and are marked all or nothing.
Each week late looses 1 mark out of 5.
7
Connectivity Software
• WDSc Websphere Development System client)
• Client Access (also used here - selectively)
• Mocha (use from home)
Software that allows you to connect your PC to the
AS/400 using communications.
8
What to do next?
Attend ALL lectures
Finish every lab assignment
Study your text and handouts
Practise
9
What is DB2?
10
DB2 UDB for iSeries
• Database is built in...not added on
• All data accessed through integrated data base
• DB2 UDB for iSeries does not have a data base
package
• iSeries is a data base machine
• AS/400 designed with relational database
• Data base provides flexibility and performance
11
# 1 Multi-User Relational
Database in the World!!
#1 in systems
#1 in end users
#1 in business
applications
# 1 in total terabytes of
relational data
Oracle
IBM DB2/400
48.0%
Other
Slice
4.0%2
0.0%
Sybase
12.0%
18.0%
Informix
18.0%
12
Based on 1995 IDC Data: AS/400 and Unix mid-range
shipments and database market share (Licenses)
Database Administrators
DB2 UDB for iSeries
AS/400
n
n
n
n
NT Server
SQL Server
DBA
No DBA Required
n
Competition
Automatic Space Management
Automatic Optimization
Database Integrity
No Resource Configuration
...
DBA
DBA Required
n
n
n
n
n
Space Management
Optimization
Database Integrity needs checking
Resource Configuration
...
13
Data Base Implementation
• Two file types
•Physical file or Table
•contains the actual data
•may/may not be keyed access
•Logical file or View
•contains no data
•different order
•reordering of fields
•changing field attributes
•expressions (translate, concatenation, etc)
•record selection based on data in fields
•joins (inner, left partial outer, exception) 14
•hierarchical merges
Implementation …
• File creation is via:
• SQL - CREATE TABLE, CREATE VIEW AS/400
maintains data dictionary and catalog for SQL
databases
• OS/400 - CRTPF, CRTLF commands
• record formats defined by user at field level by writing
data description specifications
• description becomes encapsulated in file object
• permits more options than SQL (eg. edit checks,
default values)
• field definitions can point to fields in other files (field
reference file)
15
FILES & TABLES ARE OS/400 OBJECTS
• OS/400 objects have descriptive part and space part
• Descriptive part contains file definition
• Descriptive part is accessed by HLL compilers etc.
to retrieve field definitions
• Space part contains the data and/or index
• Space part may contain multiple members index
16
SQL Implementation
•
•
•
•
V5R2
Green Screen – STRSQL
Operations Navigator – Database
WebSphere
17
Schema vs Collection vs Library?
18
Table vs File
19
View vs Index vs Logical File
20
Session Attributes
21
SQL Basics
•
•
•
•
Select
Update
Delete
Insert
22
Select Statements
• Functions
• Naming Columns
• Union
23
Creating Tables
• DSPFD – Displays a File’s Description
• DSPFFD – Displays a File’s layout
• DSOBJD – Displays an Objects Description
24
Creating Tables
• Create Table xxx as (select …) with data
• Create table xxx as (select …) without data
25
Constraints
•
•
•
•
Primary Key
Unique
Foreign Key
Check
26
Copying Data
• CPYF vs CRTDUPOBJ?
• SQL Way
27
Homework
• Print Lab 1A from
DBT544/HANDOUTF05
• Read Chapters 1 thru 4 from text
28