Relational Data Model - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Relational Data Model

Description:

The relational data model. including object-relational model. The semistructured-data model ... It's the core of SQL language and every query in SQL gets ... – PowerPoint PPT presentation

Number of Views:122
Avg rating:3.0/5.0
Slides: 13
Provided by: Lei115
Category:

less

Transcript and Presenter's Notes

Title: Relational Data Model


1
Relational Data Model
  • Lei Li
  • CS157B

2
Whats a data model?
  • Data model is a notation for describing data or
    information.
  • The description generally consists of three
    parts
  • ---------------Structure of the data
  • ---------------Operation on the data
  • ---------------Constraints on the data

3
The most important data models
  • The relational data model
  • including object-relational model
  • The semistructured-data model
  • including XML and related standards

4
Basics of the relational model
  • 1. Attributes
  • 2. Schemas
  • 3. Tuples
  • 4. Domains
  • 5. constraints

5
Relational model illustrated
6
Defining a relation Schema in SQL
  • SQL (pronounced as sequel) is the principal
    language used to describe and manipulate
    relational database.
  • Relations in SQL
  • 1. stored relation------ tables
  • 2. views------- relations defined by a
    computation
  • 3. Temporary tables----- constructed by the SQL
    language processor when it performs its job of
    executing queries and data modifications. Got
    thrown away and never stored.

7
Data types
  • Char
  • Bit
  • Boolean
  • Int
  • Float
  • Date, Time

8
Table declarations
  • Create Table table name (
  • title CHAR(100),
  • year INT,
  • length INT,
  • genre CHAR(10),
  • )

9
Simple table
title year length genre

10
Modifying relation schemas
  • 1. drop table R
  • 2. Alter table movies ADD producer INT
  • 3. Alter Table Movies Drop length

11
Relational Algebra
  • Its the data-manipulating aspect of the
    relational model
  • Its the core of SQL language and every query in
    SQL gets translated to relational algebra.

12
Overview of relational algebra
  • The usual set operations-------- union,
    intersection, difference
  • Operations that remove parts of a
    relation------selection, projection
  • Operations that combine the tuples of two
    relations
  • ------------cartesian product, natural join,
    theta join
  • Operations called renaming
Write a Comment
User Comments (0)
About PowerShow.com