Relations Prof. Yin-Fu Huang CSIE, NYUST Chapter 6.

Slides:



Advertisements
Similar presentations
Tuples Given a collection of types Ti (i=1,2,….n), a tuple value on those types is a set of ordered triples of the form
Advertisements

Relational data objects 1 Lecture 6. Relational data objects 2 Answer to last lectures activity.
Chapter 3 An Introduction to Relational Databases.
Chapter 5 Types. 5-2 Topics in this Chapter Values vs. Variables Types vs. Representations Type Definition Operators Type Generators SQL Facilities.
Relations The Relational Data Model John Sieg, UMass Lowell.
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
SQL Components DML DDL DAL. Overview u Getting the records onto the disk - mapping u Managing disk space u SQL Modes u Ceating database.
Chapter 3 An Introduction to Relational Databases.
Murali Mani SQL DDL and Oracle utilities. Murali Mani Datatypes in SQL INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME.
Domains, Relations & Base RelVars (Ch
Database Systems More SQL Database Design -- More SQL1.
Information Resources Management March 6, Agenda n Administrivia n SQL Part 2 n Homework #6.
Database Architecture The Relational Database Model.
Chapter 6 Relations. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.6-2 Topics in this Chapter Tuples Relation Types Relation Values Relation.
Chapter 6 Relations. Topics in this Chapter Tuples Relation Types Relation Values Relation Variables SQL Facilities.
Functional Dependencies Prof. Yin-Fu Huang CSIE, NYUST Chapter 11.
Database Systems Lecture # 8 11 th Feb,2011. The Relational Model of Data The term relation is basically just a mathematical term for a table. DBMS products.
Structured Query Language (SQL) A2 Teacher Up skilling LECTURE 2.
Chapter 4 The Relational Model Pearson Education © 2014.
Relational Model Session 6 Course Name: Database System Year : 2012.
Chapter 3 An Introduction to Relational Databases.
SQL Data Definition (CB Chapter 6) CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley.
Chapter 9 Integrity. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.9-2 Topics in this Chapter Predicates and Propositions Internal vs.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
Chapter 5 Types. Topics in this Chapter Values vs. Variables Types vs. Representations Type Definition Operators Type Generators SQL Facilities.
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
Lecture 7 Integrity & Veracity UFCE8K-15-M: Data Management.
Chapter 2 Adapted from Silberschatz, et al. CHECK SLIDE 16.
Further Normalization II: Higher Normal Forms Prof. Yin-Fu Huang CSIE, NYUST Chapter 13.
Chapter 10 Views. Topics in this Chapter What are Views For? View Retrievals View Updates Snapshots SQL Facilities.
Data Integrity An empty database is a correct database.
Natural vs. Generated Keys. Definitions Natural key—a key that occurs in the data, that uniquely identifies rows. AKA candidate key. Generated key—a key.
An Introduction to Relational Databases Prof. Yin-Fu Huang CSIE, NYUST Chapter 3.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
An Introduction to SQL Prof. Yin-Fu Huang CSIE, NYUST Chapter 4.
BTM 382 Database Management Chapter 7 Introduction to Structured Query Language (SQL) Chitu Okoli Associate Professor in Business Technology Management.
Chapter 7: Relations Relations(7.1) Relations(7.1) n-any Relations & their Applications (7.2) n-any Relations & their Applications (7.2)
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Chapter 5 Types. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.5-2 Topics in this Chapter Values vs. Variables Types vs. Representations.
Dec 8, 2003Murali Mani Constraints B term 2004: lecture 15.
DBSQL 5-1 Copyright © Genetic Computer School 2009 Chapter 5 Structured Query Language.
SQL Structured Query Language. Aims  To introduce the implementation of a Physical design using SQL.  To introduce SQL Data Definition Language (DDL).
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
CS 338The Relational Model2-1 The Relational Model Lecture Topics Overview of SQL Underlying relational model Relational database structure SQL DDL and.
1 DBS201: More on SQL Lecture 3. 2 Agenda How to use SQL to update table definitions How to update data in a table How to join tables together.
Chapter 4 An Introduction to SQL. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.4-2 Topics in this Chapter SQL: History and Overview The.
©Silberschatz, Korth and Sudarshan1 Structured Query Language (SQL) Data Definition Language Domains Integrity Constraints.
ITS232 Introduction To Database Management Systems Siti Nurbaya Ismail Faculty of Computer Science & Mathematics, Universiti Teknologi MARA (UiTM), Kedah.
Types Prof. Yin-Fu Huang CSIE, NYUST Chapter 5. Advanced Database SystemYin-Fu Huang Relation, tuple, cardinality, attribute, degree, domain, primary.
Integrity Prof. Yin-Fu Huang CSIE, NYUST Chapter 9.
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
CS 3630 Database Design and Implementation. 2 Mathematical Relation A mathematical relation is a subset of a Cartesian Product. A1  A2  A3  …  An.
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.
Views Prof. Yin-Fu Huang CSIE, NYUST Chapter 10. Advanced Database System Yin-Fu Huang 10.1Introduction Example: Var Good_Supplier View (S Where Status.
Advanced Database System
Ch.2 Relational Data Model E. F. Codd (1969, 1970)
Chapter 3 An Introduction to Relational Databases.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Chapter 4 An Introduction to SQL. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.4-2 Topics in this Chapter SQL: History and Overview The.
Chapter 71 The Relational Data Model, Relational Constraints & The Relational Algebra.
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
© 2016, Mike Murach & Associates, Inc.
Relational Model By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany)
STRUCTURE OF PRESENTATION :
Chapter 2: Intro to Relational Model
STRUCTURE OF PRESENTATION :
Presentation transcript:

Relations Prof. Yin-Fu Huang CSIE, NYUST Chapter 6

Advanced Database SystemYin-Fu Huang 6.1Introduction Relation types, values, and variables 6.2Tuples A set of ordered triples of the form Degree, attribute, heading Major_P# : P#Minor_P# : P#Qty : Qty P2P47

Advanced Database SystemYin-Fu Huang Properties of tuples  Every tuple contains exactly one value for each of its attributes.  There is no left-to–right ordering to the components of a tuple.  Every subset of a tuple is a tuple. The tuple type generator e.g. Var Addr Tuple { StreetChar, CityChar, StateChar, ZipChar}; 6.2Tuples (Cont.)

Advanced Database SystemYin-Fu Huang Operators on tuples  the tuple selector, assignment, equality comparison  tuple projection, tuple join  Wrap, Unwrap e.g. Naddr1:= Naddr2 Wrap {Street, City, State, Zip} As Addr; Naddr2:= Naddr1 Unwrap Addr; 6.2Tuples (Cont.)

Advanced Database SystemYin-Fu Huang 6.3Relation Types A relation value consists of a heading and a body. Relation [ ] { } The relation type generator e.g. Var Part_Structure … Relation {Major_P# P#, Minor_P# P#, Qty Qty} … ;

Advanced Database SystemYin-Fu Huang 6.4Relation Values Properties of relations (See Fig. 6.1)  Relations are normalized. ⇒ first normal form  Attributes are unordered, left to right.  Tuples are unordered, top to bottom.  There are no duplicate tuples. Relations vs. Tables

Advanced Database SystemYin-Fu Huang 6.4Relation Values (Cont.) Relation-valued attributes (See Fig. 6.2)

Advanced Database SystemYin-Fu Huang 6.4Relation Values (Cont.) Relations with no attributes  There are precisely two relations of degree zero-one that contains just one tuple, and one that contains no tuples at all. i.e. Table_Dee: Relation { } { Tuple{ } } Table_Dum: Relation { } { } Operators on relations  Relational comparisons  Other operators:   Order By

Advanced Database SystemYin-Fu Huang 6.5Relation Variables Base Relvar definition  Var Base [ ]; e.g. Var SP Base Relation {S# S#, P# P#, Qty Qty} Primary key {S#, P#} Foreign key {S#} References S Foreign key {P#} References P;  Drop Var ;

Advanced Database SystemYin-Fu Huang 6.5Relation Variables (Cont.) Updating Relvars ::= ; ::= := ; e.g. S’:=S Where Not (City=’Paris’); Insert ; Delete [Where ]; Update [Where ] {attribute update commalist>};

Advanced Database SystemYin-Fu Huang SQL Facilities Rows  A left-to-right ordering [Row] ( ) Table Types  A left-to-right ordering  Duplicated rows Values

Advanced Database SystemYin-Fu Huang SQL Facilities (Cont.) Table values and variables  Create Table ( ); : : [ ]  Drop Table : Restrict or Cascade  Alter Table e.g. Alter Table S Add Column Discount Integer Default -1;

Advanced Database SystemYin-Fu Huang SQL Facilities (Cont.) Structured Types e.g. Create Type Point As (X Float, Y Float) Not Final Ref Is System Generated; Create Table Points Of Point (Ref Is Point# System Generated …); In the example, base table Points actually has three columns (Point#, X, and Y, in that order).

Advanced Database SystemYin-Fu Huang The End.