Relational Databases. dbe: a window on a database dbe $ANTELOPE/data/db/demo/demo.

Slides:



Advertisements
Similar presentations
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
Advertisements

Chapter 3 : Relational Model
The Relational Database Model
ACCESS PART 2. Objectives Database Tables Table Parts Key Field Query and Reports Import from Excel Link to Excel.
Chapter 2 The Relational Database Model
Final Review Sunday March 13th. Databases –Entities/Rows –Attributes/Columns –Keys –Relationships –Schema –Instance.
1 Minggu 2, Pertemuan 3 The Relational Model Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
The Relational Database Model. 2 Objectives How relational database model takes a logical view of data Understand how the relational model’s basic components.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Thomas Connolly and Carolyn Begg’s
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Chapter 4 The Relational Model Pearson Education © 2014.
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Relational Model Session 6 Course Name: Database System Year : 2012.
Introduction –All information systems create, read, update and delete data. This data is stored in files and databases. Files are collections of similar.
Relational Data Model. A Brief History of Data Models  1950s file systems, punched cards  1960s hierarchical  IMS  1970s network  CODASYL, IDMS 
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Chapter 2 Adapted from Silberschatz, et al. CHECK SLIDE 16.
M Taimoor Khan Course Objectives 1) Basic Concepts 2) Tools 3) Database architecture and design 4) Flow of data (DFDs)
WEEK 11 Database Design. TABLE INSTANCE CHARTS Create Tables.
Relational Databases Database Driven Applications Retrieving Data Changing Data Analysing Data What is a DBMS An application that holds the data manages.
Copyright © Curt Hill The Relational Model of Database Basic organization and terms.
1 The Relational Database Model. 2 Learning Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical.
Min-Hung Shih 1/22/2015 Ver Database Manipulation (I)  dbe - database editor/viewer.
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ICOM 5016 – Introduction.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Database Concepts. Data :Collection of facts in raw form. Information : Organized and Processed data is information. Database : A Collection of data files.
Access Review. Access Access is a database application A database is a collection of records and files organized for a particular purpose Access supports.
+ Information Systems and Databases 2.2 Organisation.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
File and Database Design Class 22. File and database design: 1. Choosing the storage format for each attribute from the logical data model. 2. Grouping.
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Introduction.
Views, Algebra Temporary Tables. Definition of a view A view is a virtual table which does not physically hold data but instead acts like a window into.
(SQL - Structured Query Language)
* Database is a group of related objects * Objects can be Tables, Forms, Queries or Reports * All data reside in Tables * A Row in a Table is a record.
3 1 Database Systems The Relational Database Model.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Chapter 3 The Relational Database Model. Database Systems, 10th Edition 2 * Relational model * View data logically rather than physically * Table * Structural.
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
N-ary Relations & Their Applications. 2 n-ary Relations Let A 1, A 2, …, A n be sets. An n-ary relation on these sets is a subset of A 1 x A 2 x … x A.
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Week 2 Lecture The Relational Database Model Samuel ConnSamuel Conn, Faculty Suggestions for using the Lecture Slides.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. A database is a collection of information organized to provide efficient retrieval. The collected information.
Relational Database Management Systems
Chapter 2: Relational Model
Chapter 2: Intro to Relational Model
Chapter 3: Intro to Relational Model
Chapter 2: Intro to Relational Model
Theory behind the relational engine
Theory behind the relational engine
Chapter 2: Intro to Relational Model
What is a Database? A collection of data organized in a manner that allows access, retrieval, and use of that data.
02 - The Relational Database Model
Chapter 2: Intro to Relational Model
Example of a Relation attributes (or columns) tuples (or rows)
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
ICT Database Lesson 2 Designing a Database.
Microsoft Office Access is the best –selling personal computer database management system. What is Access?
Database Systems: Design, Implementation, and Management
Relational Database Operators
Presentation transcript:

Relational Databases

dbe: a window on a database dbe $ANTELOPE/data/db/demo/demo

Relational databases - Some definitions  Table: fix format ASCII text files made up of records (rows) and fields (columns) TABLE NAME

 Field: has the same attributes (size, type, format) in every table in which it appears  Record: unique combination of information FIELD RECORD

Schema  The attributes and relations that define the relational database  Defined by single text file that contains schema description schema description attribute statements for every field attribute statements for every field relation statements for every table which describe how the tables are linked/related relation statements for every table which describe how the tables are linked/related

Example Schema SCHEMA DESCRIPTION LIST of TABLES

Attribute Statement  Type  Format  Null value  Units DESCRIPTION & DETAIL  Range ATTRIBUTE

sta ATTRIBUTE

Relation Statement LIST of FIELDS TEXT DESCRIPTION RELATION / TABLE NAME

FOREIGN KEY: attributes of the table that are primary keys of other tables in the schema ALTERNATE KEY: Attributes which could uniquely identify a record but were not chosen as a primary key PRIMARY KEY: attributes which uniquely identify the records for each table

wfdisc RELATION

Tables are linked together by the primary, alternate, and foreign keys

How links via keys work  Site Table Primary Keys  Sta  Ondate::Enddate  SiteChan Table Primary Key  Chanid  Alternate Key  Sta, Chan  Ondate::Enddate Site SiteChan Subset

Result of joining the sitechan and site tables Common primary keys used for the join

Join using the GUI dbe Join via command line or

Relational Algebra  Union:  Union: If A and B are sets, then the union of A and B is the set R that contains all elements of A and all elements of B, but no other elements.  Difference:  Difference: If A and B are sets, then the difference of B and A, is the set R which contains all of elements in B, but not in A.  Rename:  Rename: change the name of a field

Relational Algebra  Selection:  Selection: selecting records by applying a test using binary operators ( ) based on the table fields  Projection:  Projection: if a1,...,an is a set of field names, the result of projection is defined as the set R that is obtained when all records in R are restricted to the set {a1,...,an}  Cartesian Product:  Cartesian Product: If A and B are sets, the Cartesian product is the set R containing all possible ordered pairs whose first component is a member of A and whose second component is a member of B

Resulting RDB functions  Edit  Sort  No join  Sort  Join & Unjoin  Select & Subset Most useful for daily work

Relational operations  Subset %dbsubset dbsite ‘lat > 45’  Sort %dbsort dbsite sta  Join %dbjoin db.arrival site

 Select/Arrange %dbselect - sta lat lon elev staname % dbsubset AprilNicoya.site 'lat.5' |\ dbsort - sta |\ dbsort - sta |\ dbjoin - arrival |\ dbjoin - arrival |\ dbselect - sta lat lon arid arrival.time chan dbselect - sta lat lon arid arrival.time chan JUDI BHZ JUDI BHZ JUDI BHZ JUDI BHZ JUDI BHZ JUDI BHZ JUDI BHZ JUDI BHZ

What is a join?  For example, given an arrival pick, you need to know the location of the recording station  ie, given station name and arrival time, lookup the location of the station in the site table.  Consider new virtual table which combines arrival and site table; each record has 1 arrival plus matching record from site table