PIR MEHR ALI SHAH ARID AGRICULTURE UNIVERSITY University Institute of Information Technology Database Systems Credit Hours: 4(3-2) Prerequisites: Course Learning Outcomes (CLOs) At the end of course the students will be able to: 1. Explain fundamental database concepts. 2. Design conceptual, logical and physical database schemas using different data models. 3. Identify functional dependencies and resolve database anomalies by normalizing database tables. 4. Use Structured Query Language (SQL) for database definition and manipulation in any DBMS None Domain C C BT Level* 2 5 C 2 C 4 *BT- Bloom’s Taxonomy, C=Cognitive domain, P=Psychomotor domain, A=Affective domain Course Contents: Basic database concepts, Database approach vs file based system, database architecture, three level schema architecture, data independence, relational data model, attributes, schemas, tuples, domains, relation instances, keys of relations, integrity constraints, relational algebra, selection, projection, Cartesian product, types of joins, normalization, functional dependencies, normal forms, entity relationship model, entity sets, attributes, relationship, entity-relationship diagrams, Structured Query Language (SQL), Joins and sub-queries in SQL, Grouping and aggregation in SQL, concurrency control, database backup and recovery, indexes, NoSQL systems. Course Objective: The objective of the course is to present an introduction to database management systems, with an emphasis on how to organize, maintain and retrieve - efficiently, and effectively information from a DBMS. Learning Outcomes: Upon successful completion of this course, students should be able to: • Describe the fundamental elements of relational database management systems • Explain the basic concepts of relational data model, entity-relationship model, relational database design, relational algebra and SQL. • Design ER-models to represent simple database application scenarios • Convert the ER-model to relational tables, populate relational database and formulate SQL queries on data. • Improve the database design by normalization. • Familiar with basic database storage structures and access techniques: file and page organizations, indexing methods including B tree, and hashing. Teaching Methodology: Lectures, Written Assignments, Practical labs, Semester Project, Presentations Courses Assessment: Exams, Assignments, Quizzes. Course will be assessed using a combination of written examinations. Reference Materials: 1. Database Systems: A Practical Approach to Design, Implementation, and Management, 6th Edition by Thomas Connolly and Carolyn Begg 2. Database Systems: The Complete Book, 2nd Edition by Hector Garcia-Molina, Jeffrey D. Ullman, Jennifer Widom 3. Database System Concepts, 6th Edition by Avi Silberschatz, Henry F. Korth and S. Sudarshan. 4. Database Management Systems, 3rd Edition by Raghu Ramakrishnan, Johannes Gehrke Week 1 Contents Theory Practical File Based System, Database Approach, Roll in Data Base Environment, History of data base Management System, Advantages and Disadvantages Of DBMSs 2 The Relational Model SQL Displaying Table Structure Selecting Specific Columns Arithmetic Expressions Operator Precedence Defining a Column Alias The Relational Model SQL Statements Defining a Column Alias Concatenation Operator Eliminating Duplicate Rows How to build and manage database? Database Systems, File based system, DBMS approach What is File based approach? Limitations of File based approach DBMS approach, Advantages of DBMS, Cost and Risks Factors. Three Level ANSI-SPARC Architecture Restricting and Sorting Data External level, Conceptual Level, Internal Level Limiting Rows Selected Disadvantages of Three Level Architecture Comparison Operators Other operators (BETWEEN, IN, LIKE, IS NULL) 3 4 5 Entity Relationship modeling o o o o o o o 6 Entity Attributes and its types Identifier Primary Key Candidate Key Relationship Degree of Relationship Unary Binary Ternary Quaternary Cardinality of Relationship o One-to-one relationship o One-to-many relationship o Many-to-many relationship Minimum/Maximum Cardinality o Optional one o Optional Many o Mandatory one o Mandatory Many CASE STUDY (One in class and two as assignment) 7 Enhanced ERD o Super Type o Sub Type o Generalization o Specialization o Attribute Inheritance o Relationship Inheritance o Constraints Views creation Logical Operators and Rules of Precedence Order by Clause Single-Row Functions Character functions Number functions Date functions Conversion function Group Functions – AVG – COUNT – MAX – MIN – STDDEV – SUM – VARIANCE Displaying Data from Multiple Tables Sub queries 8 Completeness Constraint Total Specialization Partial Specialization Disjoint Constraint Disjoint Rule Overlap Rule CASE STUDY ASSIGNMENT Transformation of (E)ER Model into Relational Model Attributes Simple Composite Multivalued Entities Regular Weak Associative Relationship Unary One-to-one One-to-Many Many-to-Many Binary One-to-one o Minimum /Maximu m same on both o OptionalMandator y One-to-Many Many-to-Many • • • • • Insert rows into a table Update rows in a table Delete rows from a table Merge rows in a table Control transactions Ternary Quaternary Super Type Subtype CASE STUDY of Transformation 9 o o o o MID TERM Data Normalization Characteristics of Suitable Relation Advantages of Suitable Relations Goal of Normalization Data Anomalies Insertion Anomaly Deletion Anomaly Updation Anomaly Creating and Managing Tables 10 o Definitions of Some Terms Functional Dependency Partial Dependency Transitive Dependency o First Normal Form o Second Normal Form o Third Normal Form CASE STUDY • • • • • 11 o Relational Algebra o Writing relational calculus queries in relational algebraic query. Assignment 12 o o o o o Physical Design Purpose Goal Inputs Decisions Designing Field Describe a view Create a view Retrieve data through a view Alter the definition of a view Insert, update, and delete data through a view • Drop a view o o o o Physical records Page De-normalization Partitioning Horizontal Vertical 13 o Objectives during selection of data type o Controlling Data Integrity Data type Default value Range control Null value control Referential integrity o File Organization Factors o Sequential File Organization o Indexed File Organization Hybrid Key range Hash o Data replication Creating indexes Hashed File Organization 14 15 16 17 Introduction to Mongo DB Database Security Database Recovery Stored procedures Project demos Final Exam Hands On Practice in Mongo DB Sequence Index Synonym Controlling User Access Creating users and granting privileges to users. Recovery Triggers