360 likes | 506 Views
Database Design. Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San José State University One Washington Square San José, CA 95192-0180 http://www.engr.sjsu.edu/~fayad, m.fayad@sjsu.edu. Lesson 1: Infinite Relational Database. 2.
E N D
Database Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San José State University One Washington Square San José, CA 95192-0180 http://www.engr.sjsu.edu/~fayad, m.fayad@sjsu.edu SJSU -- CmpE
Lesson 1: Infinite Relational Database 2 SJSU – CmpE --- M.E. Fayad
Lesson Objectives • Understand Infinite Relational Databases • Explore the view level • Understand the logical view • Abstract Data Type 3 SJSU – CmpE --- M.E. Fayad
Data Abstraction- allows people to forget unimportant details View Level– a way of presenting data to a group of users Logical Level– how data is understood to be when writing queries Infinite Relational Databases 4 SJSU – CmpE --- M.E. Fayad
The highest level of data abstraction is the view level A view is a way of presenting data to a particular group of users. Data Presentation may depend on users preferences. Each view has to be functional for the users. This means that when designing a view we must keep in mind the functions to be preformed on the data. The View Level 5 SJSU – CmpE --- M.E. Fayad
View level presentation of the data: Science, Art, or both (discussion) We will illustrate examples from different computer fields, such as computer graphics, for view level presentation of complex data, especially spatiotemporal data, such as realistic display of images and movies. The View Level 6 SJSU – CmpE --- M.E. Fayad
Examples: Charts Graphs Drawings Maps Video or Animation The View Level Examples? What is a view? What is a model? What are the differences between a model and a view? 7 SJSU – CmpE --- M.E. Fayad
Example: Infinite relational data model Relation– table (Each table has a name and defines a relation) Relational scheme– top row / list of attributes (The top row of a table is called an attribute name) (The ordered set of attributes of a table is called a relation scheme.) Arity or dimension– number of attributes of a relation (We will use arity and dimension interchangeably with a preference for dimension in the case of spatiotemporal relations.) The Logical Level 8 SJSU – CmpE --- M.E. Fayad
Example: Infinite relational data model Database schema– set of relation names and schemes Tuple / Point– each row below the scheme (we will use these two terms interchangeably with a preference for point in the case of spatiotemporal relations. Instance – the set of tuples in a table (Each row describes an instance of the scheme.) (Please remember a relation schemes are usually fixed while a relation instances may change over time due to database updates.) The Logical Level 9 SJSU – CmpE --- M.E. Fayad
Example (1) 10 SJSU – CmpE --- M.E. Fayad
Name the relations! What is arity of each relation? What is the relation scheme of each relation? What is the database scheme? How many tupls in each of the relation? How many instances of each of these relations? Example (2) 11 SJSU – CmpE --- M.E. Fayad
T or F: Relation schemes are usually fixed (T) Relation instances change with updates (T) Example Scheme: Taxrecord(SSN,Wages,Interest,Capital_gain) Taxtable(Income,Tax) Relation schemes & Instances (1) 12 SJSU – CmpE --- M.E. Fayad
Example: Streets(Name, X, Y ) Streets contains pairs of street names and (x,y) points such that the point belongs to the street. There are an infinite number of (x, y) locations associated with each street. Example: Crops(Corn,Rye,Sunflower, Wheat) Crops contains all possible combinations of four crops that a farmer could plant. There are an infinite number of tuples in any instance of this relation. Relation schemes & Instances (2) SJSU – CmpE --- M.E. Fayad
Other examples: Temporal Data Spatial Data Operations Research Infinite Relational Data Model 14 SJSU – CmpE --- M.E. Fayad
In many application areas of machine learning and data mining, researchers face challenges entailed by temporal and spatial data. What are the differences between temporal and spatial data? Temporal & Spatial Data 15 SJSU – CmpE --- M.E. Fayad
Temporal Data Type (1) The user-defined temporal data type is a time representation specially designed to meet the specific needs of the user. For example, the designers of a database used for class scheduling in a school might be based on a "Year:Term:Day:Period" format. Terms belonging to a user-defined temporal data type get the same query language support as do terms belonging to built-in temporal data types such as the DATE data type. 16 SJSU – CmpE --- M.E. Fayad
A temporal database is a database that supports some aspect of time, not counting user-defined time. Temporal Databases 17 SJSU – CmpE --- M.E. Fayad
The spatiotemporal is used to indicate that the modified concept concerns simultaneous support of some aspect of time and some aspect of space, in one or more dimensions. Spatiotemporal 18 SJSU – CmpE --- M.E. Fayad
Domain– range of values for an attribute. string, integers or real numbers Scalar Domain– always a single value (ex: string, integer or real number) Abstract data type domains – composed of scalar domains. Abstract Data Types (1) 19 SJSU – CmpE --- M.E. Fayad
Example: Vertices(Cities) The domain of Cities is a set of strings. Example: Streets(Name, Extent) The domain of Extent is a set of (x,y) points. Abstract Data Types (2) 20 SJSU – CmpE --- M.E. Fayad
A database is a collection of related data. A database management system (DBMS) is a collection of programs that enables users to create and maintain a database. A database system = database + DBMS Database Glossary (1) 21 SJSU – CmpE --- M.E. Fayad
A database can be of any size and of varying complexity. IRS database Assume there are a 100 million taxpayers Each taxpayer file has an average of 5 forms. Each form is approx. 200 chars Assume also that IRS keeps the past three returns for each taxpayer? What is the size of IRS’s database? (100*(106)*200*5) = 4*(1011) = 400 gigabytes Database Glossary (2) 22 SJSU – CmpE --- M.E. Fayad
Self-describing nature of a database system Database contains the database itself, the definition or description of the database structure and constraints The definition is stored in the system catalog which contains the information, such as structure of each file, the type and storage format of each data item, and various constraints on the data. The information stored in the catalog is called meta-data. Characteristics of the Database Approach 23 SJSU – CmpE --- M.E. Fayad
Insulation between programs and data, and data abstraction In OO databases users can define operations on data as part of the database definitions. An operation is called a function is specified in two parts: the interface or signature and the implementation Data abstraction Characteristics of the Database Approach 24 SJSU – CmpE --- M.E. Fayad
Support multiple views of the data Dealing with Raw Data Many users = different perspectives or views of the database. Facilities for multiple views Characteristics of the Database Approach 25 SJSU – CmpE --- M.E. Fayad
Sharing of data and multiuser transaction processing A multiuser DBMS must allow multiple users to access the database at the same time. Concurrency control – to ensure that several users trying to update the same data do so in a controlled manner so that the result of the updates is correct. Characteristics of the Database Approach 26 SJSU – CmpE --- M.E. Fayad
Database administrators Database designers End users (casual end users, naïve or parametric end users, sophisticated end users, and stand-alone user System analysts and application programmers or software engineers Actors on the Scene 27 SJSU – CmpE --- M.E. Fayad
DBMS system designers and implementers Tool developers Operators and maintenance personnel Worker Behind the Scene 28 SJSU – CmpE --- M.E. Fayad
Controlling redundancy Redundancy is storing the same data multiple times that lead to several problems: Duplication of effort Waste of storage space Inconsistent Advantages of Using DBMS (1) 29 SJSU – CmpE --- M.E. Fayad
Restricting unauthorized access DBMS should provide a security and authorization mechanisms which specify account restrictions. DBMS should enforce these restrictions automatically. Advantages of Using DBMS (1) 30 SJSU – CmpE --- M.E. Fayad
Providing persistent storage for program objects and data structures In OO Database Systems, an object said to be persistent if it survives the execution of program execution and can be later retrieved by another program. Compatibility – OODBs offer data structure compatible with one or more OO programming languages Traditional DB systems often suffer from the so-called impedance or mismatch problem Advantages of Using DBMS (1) 31 SJSU – CmpE --- M.E. Fayad
Permitting inferencing and actions using rules Some database systems provide capabilities for defining deduction rules for inferencing new information from the stored database facts. Such systems are called deductive database systems. Advantages of Using DBMS (1) 32 SJSU – CmpE --- M.E. Fayad
Advantages of Using DBMS (2) • Providing multiple user interfaces • Representing complex relationships among data • Enforcing integrity constraints • Providing backup and recovery 33 SJSU – CmpE --- M.E. Fayad
Potential enforcing standards Reducing application development time Flexibility Availability of up-to-date information Economics of Scale Additional Advantages of Using DBMS (2) 34 SJSU – CmpE --- M.E. Fayad
T/F: a. A view is a way of presenting data to a particular group of users. b. Any relation can be presented by multiple views c. Arity = the number of columns in the relation. d. An instance = any row of a relation e. Spatial database is a database that supports some aspect of time, not counting f. Spatial data in the form of two- or three-dimensional images. g. Spatial data is any information about the location and shape of, and relationships among, geographic features. This includes remotely sensed data as well as map data. Discussion Questions 35 SJSU – CmpE --- M.E. Fayad
Task 1: Data Modeling Using Entity-Relationship Model Tasks for Next Lecture 36 SJSU – CmpE --- M.E. Fayad