🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Document Details

Tags

database management relational databases data structures computer science

Full Transcript

Working with Databases and Database Objects The Relational Database Modeling Logical View of Data Relational Model - Enables programmer to view data logically rather than physically Table Has advantages of structural and data independence. Resembles a file from conceptual point of vie...

Working with Databases and Database Objects The Relational Database Modeling Logical View of Data Relational Model - Enables programmer to view data logically rather than physically Table Has advantages of structural and data independence. Resembles a file from conceptual point of view. Easier to understand than its hierarchical and network database predecessors. Tables and their Characteristics Table: two-dimensional structure composed of rows and columns. Contains group of related entities = an entity set Terms entity set and table are often used interchangeably. Table also called a relation because the relational model’s creator, Codd, used the term relation as a synonym for table. Think of a table as a persistent relation: - A relation whose contents can be permanently saved for future use Characteristics of Relational Table Student table attribute values Student Classification Relational Database Keys Composite key Composed of more than one attribute Key Attribute Any attribute that is part of a key Superkey Any key that uniquely identifies each row Candidate key A superkey without redundancies Foreign Key (FK) An attribute whose values match primary key values in the related table Referential Integrity FK contains a value that refers to an existing valid tuple (row) in another relation Secondary key used strictly for data retrieval purposes Relational Database Operators Relational Algebra -Defines theoretical way of manipulating table contents using relational operators - Use of relational algebra operators on existing tables (relations) produces new relations Union o Combines all rows from two tables, excluding duplicate rows o Tables must have the same attribute characteristics Intersect Yields only the rows that appear in both tables Difference Yields all rows in one table not found in the other table that is, it subtracts one table from the other Product Yields all possible pairs of rows from two tables. Also known as the Cartesian Product. Select Can be used to list either all row values or it can yield only those row values that match a specified criterion. Yields values for all rows found in a table, a horizontal subset of a table. Project Yields all values for selected attributes. Yields a vertical subset of a table The Data Dictionary and System Catalog Data dictionary Provides detailed accounting of all tables found within the user/designer-created database. Contains (at least) all the attribute names and characteristics for each table in the system. Contains metadata—data about data. Sometimes described as “the database designer’s database” because it records the design decisions about tables and their structures System Catalog - Contains metadata. Detailed system data dictionary that describes all objects within the database. Terms “system catalog” and “data dictionary” are often used interchangeably. Can be queried just like any user/designercreated table Data Redundancy Revisited Data redundancy leads to data anomalies - Such anomalies can destroy the effectiveness of the database Foreign Keys - Control data redundancies by using common attributes shared by tables. Crucial to exercising data redundancy control Sometimes, data redundancy is necessary Indexes Arrangement used to logically access rows in a table Index key - Index’s reference point. Points to data location identified by the key. Unique index - Index in which the index key can have only one pointer value (row) associated with it Each index is associated with only one table Database Performance Tuning and Query Optimization Database Performance-Tuning Concepts Goal of database performance is to execute queries as fast as possible. Database performance tuning - Set of activities and procedures designed to reduce response time of database system All factors must be checked to ensure that each one operates at its optimum level and has sufficient resources to minimize occurrence of bottlenecks Good database performance starts with good database design Clients and Server Client Side - Objective is to generate SQL query that returns correct answer in least amount of time, using minimum amount of resources at server end. - SQL performance tuning Server Side - DBMS environment must be properly configured to respond to clients’ requests in fastest way possible, while making optimum use of existing resources. - DBMS performance tuning Database Schema A database schema is the skeleton structure that represents the logical view of the entire database. It defines how the data is organized and how the relations among them are associated. It formulates all the constraints that are to be applied on the data. Physical Database Schema o This schema pertains to the actual storage of data and its form of storage like files, indices, etc. It defines how the data will be stored in a secondary storage. Logical Database Schema o This schema defines all the logical constraints that need to be applied on the data stored. It defines tables, views, and integrity constraints. 1-12. Give 6 Relational Database Operators Relational Algebra And define. 13-20. Give 4 characteristic of relational table. 21-30 Create table with 10 possible attribute and values.

Use Quizgecko on...
Browser
Browser