Types Prof. Yin-Fu Huang CSIE, NYUST Chapter 5. Advanced Database SystemYin-Fu Huang Relation, tuple, cardinality, attribute, degree, domain, primary.

Slides:



Advertisements
Similar presentations
Relational data objects 1 Lecture 6. Relational data objects 2 Answer to last lectures activity.
Advertisements

Chapter IV Relational Data Model Pemrograman Sistem Basis Data.
The Relational Model and Relational Algebra Nothing is so practical as a good theory Kurt Lewin, 1945.
Relational Database. Relational database: a set of relations Relation: made up of 2 parts: − Schema : specifies the name of relations, plus name and type.
Chapter 3 : Relational Model
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
Chapter 5 Types. 5-2 Topics in this Chapter Values vs. Variables Types vs. Representations Type Definition Operators Type Generators SQL Facilities.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 28 Database Systems I The Relational Data Model.
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Relations The Relational Data Model John Sieg, UMass Lowell.
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
Chapter 3. 2 Chapter 3 - Objectives Terminology of relational model. Terminology of relational model. How tables are used to represent data. How tables.
1 Relational Model. 2 Relational Database: Definitions  Relational database: a set of relations  Relation: made up of 2 parts: – Instance : a table,
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
1 Pertemuan 04 MODEL RELASIONAL Matakuliah: >/ > Tahun: > Versi: >
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 4-1 David M. Kroenke Database Processing Chapter 7 Structured Query Language.
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.
DATABASES AND SQL. Introduction Relation: Relation means table(data is arranged in rows and columns) Domain : A domain is a pool of values appearing in.
Chapter 6 Relations. Topics in this Chapter Tuples Relation Types Relation Values Relation Variables SQL Facilities.
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.
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.
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.
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
CS 3630 Database Design and Implementation. 2 Mathematical Relation A mathematical relation is a subset of a Cartesian Product. A1  A2  A3  …  An.
Chapter 2 Adapted from Silberschatz, et al. CHECK SLIDE 16.
Chapter 10 Views. Topics in this Chapter What are Views For? View Retrievals View Updates Snapshots SQL Facilities.
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.
1 Mathematical Relation A mathematical relation is a subset of a Cartesian Product. A1  A2  A3  …  An = {(x1, x2, x3, …, xn): xi  Ai} R  A1  A2.
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.
1 The Relational Model. 2 Why Study the Relational Model? v Most widely used model. – Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. v “Legacy.
FALL 2004CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
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.
Slide Chapter 5 The Relational Data Model and Relational Database Constraints.
Chapter 5 Types. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.5-2 Topics in this Chapter Values vs. Variables Types vs. Representations.
Introduction to Database System Adisak Intana Lecturer Chapter 7 : Data Integrity.
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).
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 9 Structured Query Language.
CMPT 258 Database Systems The Relationship Model (Chapter 3)
DATA AND SCHEMA MODIFICATIONS CHAPTERS 4,5 (6/E) CHAPTER 8 (5/E) 1.
The Relational Model. 2 Relational Model Terminology u A relation is a table with columns and rows. –Only applies to logical structure of the database,
ITS232 Introduction To Database Management Systems Siti Nurbaya Ismail Faculty of Computer Science & Mathematics, Universiti Teknologi MARA (UiTM), Kedah.
CS34311 The Relational Model. cs34312 Why Relational Model? Currently the most widely used Vendors: Oracle, Microsoft, IBM Older models still used IBM’s.
Relations Prof. Yin-Fu Huang CSIE, NYUST Chapter 6.
Integrity Prof. Yin-Fu Huang CSIE, NYUST Chapter 9.
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
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.
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 4 The Relational Model Pearson Education © 2009.
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
Chapter 3 The Relational Model. Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. “Legacy.
1 CS122A: Introduction to Data Management Lecture #4 (E-R  Relational Translation) Instructor: Chen Li.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Fundamental of Database Systems
Insert, Update and the rest…
The Relational Model Relational Data Model
DATABASE Purpose of database
STRUCTURE OF PRESENTATION :
Presentation transcript:

Types Prof. Yin-Fu Huang CSIE, NYUST Chapter 5

Advanced Database SystemYin-Fu Huang Relation, tuple, cardinality, attribute, degree, domain, primary key. (See Fig. 5.1) 5.1Introduction

Advanced Database SystemYin-Fu Huang 5.1Introduction (Cont.) Informal equivalents (See Fig. 5.2)

Advanced Database SystemYin-Fu Huang 5.2Domains A domain is nothing more nor less than a data type. e.g. P.Weight+SP.Qty ? P.Weight*SP.Qty P.Weight=SP.Qty ? P.City=S.City Values Are Typed Type Definition Type … ; e.g. Type S# Possrep (Char); Drop Type ; Possible Representations  A select operator and a set of The_operators Operator Definition Type Conversion e.g. S# (‘S1’)

Advanced Database SystemYin-Fu Huang 5.3Relation Values Given a collection of n types or domains Ti (i=1, 2, …, n), not necessarily all distinct, r is a relation on those types if it consists of two parts, a heading and a body.  The heading is a set of n attributes of the form Ai:Ti  The body is a set of m tuples t, where t in turn is a set of components of the form Ai:vi  Example {S#:S#, {S#:S#(‘S1’), Sname:Name, Sname:Name(‘Smith’), Status:Status, Status:20, City:City}City:‘London’} Properties of Relations a. There are no duplicate tuples. b. Tuples are unordered, top to bottom. c. Attributes are unordered, left to right. d. Each tuple contains exactly one value for each attribute. ⇒ first normal form

Advanced Database SystemYin-Fu Huang 5.3Relation Values (Cont.) Relation-Valued attributes (See Fig. 5.3)

Advanced Database SystemYin-Fu Huang 5.4Relation 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 ; Updating Relvars := ; e.g. S:=S Minus (S Where City=’Paris’);

Advanced Database SystemYin-Fu Huang SQL Facilities Create Domain Create Table Insert Alter Domain Alter Table Update Drop Domain Drop Table Delete Domain  Create Domain [ ] [ ];  Drop Domain ; option: Restrict or Cascade

Advanced Database SystemYin-Fu Huang SQL Facilities (Cont.) Base Table  SQL tables are allowed to include duplicate rows.  SQL tables are considered to have a left-to-right column ordering.  Create Table ( ); : Column definition [ ]  Alter Table e.g. Alter Table S Add Column Discount Integer Default -1;  Drop Table option: Restrict or Cascade

Advanced Database SystemYin-Fu Huang The End.