Download presentation
Presentation is loading. Please wait.
1
DATABASES – I IS 524 Dr. Chandra Amaravadi
2
IN THIS PRESENTATION.. Importance of databases
Real world concepts: entities, eclasses, attributes Data model Organization concepts DBMS & DBMS activities and functions
3
NEED FOR DATABASES All organizations need to manage information
A church needs to maintain information on donations A consulting company needs to manage its contacts A doctor needs to know if a patient is allergic to a particular medication. An airline exec needs to know occupancy on a flight. Information is the lifeblood of an organization.
4
NEED FOR DATABASES.. To get information when we need it, it needs organization. A database can be thought of as an organized collection of information. What is information used for? What is it about? Where does it orginate?
5
BASIC DATA CONCEPTS
6
REAL WORLD CONCEPTS Entities Entity Classes Attributes Data models
Database approach/philosophy
7
ENTITIES Individual examples of things and objects are called entities. They are modelled only as a collection.
8
WE ARE MORE INTERESTED IN
Eclasses has has Organization customers departments has eclasses has product Sales/vendor Organization deals with many eclasses
9
ENTITY CLASSES HAVE PROPERTIES
Properties are called attributes customers Departments Dept. code, name, manager, budget machines/ parts Sales/vendors
10
DISCUSSION Classify the following as entity, entity class or attribute
John (as a person) San Francisco (as name of a city) Customer Book Store# Customs Microsoft Microsoft employees The book “The Second Machine Age” Invoice Production
11
SUMMARY OF CONCEPTS Entity – Individual example of person, place or thing. Entity Class – Collection of related entities. Attributes – Properties of entity classes about which we would like to collect information. Eclasses & attributes are used in developing data models
12
DATA MODELS (ER MODELS)
Abstract view of the data & relationships Captures relationships between eclasses Supports DB design & implementation Relationship between students and courses? between doctors and patients? between teams and players?
13
DATA MODELS… Three types of relationships among entity classes A B A B
1:1 For each value of A, one and only one value of B and vice versa. A B 1:M A For each value of A, many values of B, but for each B only one A. B M:N A B For each value of A, many values of B and vice versa.
14
DISCUSSION Identify the types of the following relationships
Company -- president Instructor -- students Flights -- pilots City -- convention centers Club -- members Team – players (professional) Company -- city Books – authors Artists -- records
15
THE DATA BASE APPROACH Entity classes File 1 File 2 Organization
cust. File 2 emp. Organization Data model Data base
16
BASIC ORGANIZATION CONCEPTS
17
BASIC ORGANIZATION CONCEPTS
data vs information attribute primary key file record schema
18
DEFINING DATA Data: Data consists of raw facts e.g. 298-2034
USA China Russia Great Britain Germany Japan Australia France Are raw facts useful? meaningful?
19
INFORMATION Information: collection of facts, data presented in a context, elaboration of data. Country Gold Silver Bronze Total USA 46 29 104 China 38 27 23 88 Russia 24 26 32 82 Great Britain 17 19 65 Germany 11 14 44 Japan 7 Australia 16 12 35 France 34
20
INFORMATION AS A COLLECTION OF FACTS
Name: Chris Nash DOB: Profession: Engineer Address: Walnut street. Details describe a person more. They are called ______
21
NOTION OF A RECORD Collection of facts is called a ________
Acct#: Date: /5/14 Time: :48 pm Merchant: WIU Union Card type: Master Card Issuer: First Bank It is actually a collection of __________ values
22
ONE ATTRIBUTE HAS A UNIQUE VALUE
Which of these has a unique value? Acct#: Date: /5/14 Time: :48 pm Merchant: WIU Union Card type: Master Card Issuer: First Bank The unique attribute is called ___________. 3300 3305 3313
23
ORGANIZATION OF DATA/ INFORMATION Transaction#: 55643 Date: 12/5/15
Time: :08 pm Merchant: Vitales Card type: Master Card Issuer: First Bank Transaction#: Date: /6/15 Time: :10 pm Merchant: WIU Union Card type: Master Card Issuer: First Bank Observations about these two “units” of data?
24
TRADITIONAL CONCEPT OF A FILE
Assume the following is stored somewhere, Western Illinois University strives to maintain a community which values academic excellence; institutional integrity; and justice, equity, and diversity. Such an environment is essential in fostering the intellectual growth and personal development of all students. Each member of the University community shares responsibility in maintaining conditions which support the University's purpose. The Code of Student Conduct is designed to provide basic guidelines to advance the University's mission as a premier educational institution. A traditional file is a collection of characters
25
CONCEPT OF A DATABASE FILE
Transaction#: Date: /5/15 Time: :08 pm Merchant: Vitales Card type: Master Card Issuer: First Bank Transaction#: Date: /6/15 Time: :10 pm Merchant: WIU Union Card type: Master Card Issuer: First Bank Transaction ID Date Time Merchant 55643 12/05/15 4:08 pm Vitales 55644 12/06/15 4:10 pm WIU Union A database file consists of _________________ .
26
DATABASE ORGANIZATION
Structure/schema Attributes/field names Primary key PROD# DESCR. PRICE QUANTITY IR888E Refrigerator $1,800 20 TS3233 Television $67 32 Record Record A database is organized into ______, _________ and _______. attr. values
27
DATABASE ORGANIZATION..
PRIMARY KEY (FYI) Also referred to as a key Every table should have one Generally short and a number Value should be unique in a table; in other words ____ ? Can be one attribute or a combination listed as left most attribute E.g. SS#, id#, vin#, isbn#
28
DATABASE ORGANIZATION
Database – A group of related files; collection of information File/table – A group of related records Record – a grouping of related field values Attribute – property e.g. hair color Schema -- This is the logical view of the database (tables and fields) Primary key – An attribute whose values are unique within a file Secondary key – Any other attribute DBMS – software program to provide controlled data access Database Files/tables Records Attr. values
29
DBMS
30
DBMS DBMS - SW program to create, manage and provide controlled access to the data Example Access, Oracle, DB2 What can we do with a DBMS?
31
DBMS ACTIVITIES & FUNCTIONS
Activities with DBMS Define structure/schema Data entry Modify data query data get reports
32
DATA DEFINITION Define structure/schema
Field Name Data type Description Length Decimals Prod# Numeric Unique prod code 6 Descr Text Short prod description 25 Price Currency Product price 2 Attributes and data types (and other characteristics) are specified as part of data definition
33
DATA ENTRY Product #: Description: A form is used to enter data
Heading PRODUCT DATA ENTRY Label Product #: Description: Field Data entry form
34
MODIFY DATA Modify data Add Delete Change Records/field values
35
Query by example (QBE) form
QUERYING DATA -QBE Can use QBE or SQL to query data list products costing less than $200 prod# descr. price quantity < 200 Query by example (QBE) form list employees in finance department e_ssn ename edept e_join_dt “finance”
36
RETRIEVAL WITH SQL The structured query language can be used instead of QBE Each SELECT statement has three parts SELECT, FROM and WHERE SELECT is used to select output attributes FROM is used to specify the source tables WHERE is used for row selection criteria e.g. price < 400; zip = etc. SELECT <attr. list> FROM <tables> WHERE <condition1 AND/OR condition 2…>
37
RETRIEVAL WITH SQL.. Reservation RESULT SQL QUERY Flt# Confirm#
Pname Confirm# AA1802 Smith PA5R2 PA802 LX5R2 UA3702 Mahoney ZB46A RESULT SQL QUERY Flt# Confirm# AA PA5R2 PA LX5R2 Select Flt#, Confirm# From Reservation Where Pname = “Smith”;
38
ANOTHER EXAMPLE What is the result of the query?
SELECT flt#, deptime, arrtime FROM ?? WHERE depcity = "PHX" and destcity = "ORD"; FLIGHTS flt # depcity destcity deptime arrtime AA 802 PHX ORD 1:51 AM 6:05AM UA 3702 COS D 7:35 AM 8:05 AM AA 812 SEA 4:55 AM 9:00 AM D 42 5:40 PM 9:15PM UA775 DFW STL 4:45 PM 5:30 PM What is the result of the query?
39
DISCUSSION Write SQL queries to list: 1) employee names.
2) Employees who live in Macomb. 3) employees who enjoy soccer. Emp EID eName eAddr eCity 423 Smith 100 Oak lane Macomb 425 501 Johnson 1430 N. Park street Rock Island
40
THE THEORY OF RETRIEVAL
Dept dCode dName dMgr Fin. Finance Jon Sas Sales and service Ross Acc. Accounts Jan DEPTS. have EMPLOYEES Emp EID eName eAddr. 11893 Jon 100 Oak street 11895 Carey 15 Candy lane 11896 Ross 1317 Fox creek list EID, eName, dName
41
RETRIEVAL FROM MULTIPLE TABLES
When data is retrieved from multiple tables, it is called a multi-table query Attr. From different tables are linked primary key in one table cross-reference key in the other table The linking is carried out in the “Where” part of a query
42
MULTI-TABLE SELECT STATEMENT
Used to retrieve data from more than one table SELECT table1.attr1, table2.attr FROM table1, table2, WHERE table1.fkey = table2.fkey AND/OR condition1 AND/OR ; RULES When there are multiple tables, attr. names preceded by table name. “From” will have list of tables as usual. The WHERE part will have values of common attr. equated there can be more than one condition, connected by AND or OR Using the rules above, write a query to list EID, eName, dName
43
GETTING DATA OUT.. A report specification RH Title PH Column Headings
PRODUCT LISTING Title PH Column Headings PRODUCT # DESCR. PRICE Detail Product # Descr. Price Fields PF RF Average Price Footer A report specification
44
GETTING DATA OUT.. PRODUCT LISTING PROD# DESCRIPTION PRICE
M Chair $ M Table $200.00 Average Price $153.00 A generated report
45
SUMMARY OF DBMS ACTIVITIES
Activities with DBMS Define structure /schema Enter data modify data query data get reports
46
DBMS ARCHITECTURE D B M S Kernel Data Defn. SQL Prog. Language
Interface Data Diction- ary Screen/ Report Gen. Appln. Gen. D B M S Kernel Export/Import
47
USEFULNESS OF DATABASES
48
USAGE OF DATA/INFORMATION
What if a customer wants know price of a shirt in a department store? Returns? What if a manager wants to know what products were sold on a particular day? Suppose we have detailed information on each and every transaction in a store, what can we do with that?
49
IMPORTANCE OF DBMS’s Operational Usage:
To store and record information e.g. bal, price, grades etc. To retrieve information e.g. check#432 cashed? To report information e.g. daily sales To answer queries e.g. how many shoes were sold? Strategic Usage: To analyze trends Identify sales prospects
50
DISCUSSION QUESTIONS A collection of information about machines and parts is called _____? A collection of records is called________ ? The smallest unit of data in a database is _________ ? What is QBE apart from expansion of abbreviation? How does QBE differ from SQL? What does data definition mean? Where would databases be used? How are databases used? Do databases deal with data or information? What is a good database application?
51
THAT’S ALL FOLKS!
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.