Database Creation and Maintenance

Course Code (Credit):

CUTM1033(2-1-1)

Course Objectives:

  • Foundation knowledge in database concepts, technology and practice to groom students into well-informed database application developers.
  • Make the students understand the principles behind relational database management systems, including the database environment, the relational model, relational languages, develop simple SQL queries using MySQL Workbench.
  • Strong practice in SQL programming through a variety of database problems.

Learning Outcomes:

  • Construct database models for different database applications.
  • Construct the entity-relationship diagrams of different databases using MySQL Workbench.
  • Convert the entity-relationship diagrams into relational tables.
  • Design, implement and normalize a relational model for a given problem domain.
  • Write SQL queries for performing database operations.
  • Different functions to update or delete data from the databases.

Course Syllabus:

Module I: Database System Concepts and Data Models (9 Hrs)

Database Approach: Database, Approaches to Building a Database, Data Models, Database Management System (DBMS), DBMS Architecture, Building a DBMS, Components of DBMS Environment.

File Based Systems and Database Systems: File Based Approach, Database Systems, File- oriented Systems vs. Database Systems, Advantages and Disadvantages of DBMS.

Data Source: Types of Data sources, Access Documents and Information from Data Sources.

Roles in Database Environment: Database Users, Database Administrators (DBA)

Database installation procedure: Functionalities of MySQL Workbench, Creating a connection in MySQL Workbench, Setup the MySQL Workbench, Working of SQL Editor, Data Export & Import, Database table creation & insertion of values.

Practice:

  • Collect data from different data sources and identify the type of data source.
  • Installation of MySQL Workbench. Import and export the database into MySQL Workbench.
  • Create instances of database in MySQL.
Module II: Database System Architecture and ER Diagram (9 Hrs)

Three Level Architecture, External Level, Conceptual Level, Internal Level, Schemas, Mappings, Instances, Data Independence, Data Abstraction, E/R Model - Conceptual data modeling - motivation, entities, entity types, various types of attributes, relationships, relationship types, E/R diagram notation, examples, Database Design & Modeling using MySQL Workbench, Create EER Diagram with MySQL Workbench.

Practice:

  • Analyze the problem and come with the entities in it. Identify what data has to be persisted in the databases.
  • Use MySQL Workbench to construct an E-R diagram for a car-insurance company whose customers own one or more cars each. Each car has associated with it zero to any number of recorded accidents.
  • Use MySQL Workbench to construct an E-R diagram for a hospital with a set of patients and a set of medical doctors. Associate with each patient a log of the various tests and examinations conducted.
  • A university registrar’s office maintains data about the following entities:
    • (a) Courses, including number, title, credits, syllabus, and prerequisites;
    • (b) Course offerings, including course number, year, semester, section number, instructor(s), timings, and classroom;
    • (c) Students, including student-id, name, and program;
    • (d) Instructors, including identification number, name, department, and title.
  • Further, the enrollment of students in courses and grades awarded to students in each course they are enrolled for must be appropriately modeled. Use MySQL Workbench to construct an E-R diagram for the registrar’s office. Document all assumptions that you make about the mapping constraints.

Module III: Relational Data Model and Relational algebra (9 Hrs)

Relational Data Model: Concept of relations, schema-instance distinction, keys, referential integrity and foreign keys. Relational algebra operators: selection, projection, cross product, various types of joins, division, example queries, tuple relation calculus, domain relational calculus, converting the database specification in E/R notation to the relational schema.

Practice: 1. Converting an E-R diagram of a given student-section-course database to a relational schema. 2. Converting an E-R diagram of a given hospital database to a relational schema.

Module IV: Structured Query Language-DDL (7 Hrs)

Database installation procedure: Database table creation & insertion of values.

Database Languages: SQL - DDL, DML, TCL, DCL

SQL: Data definition in SQL, table, key and foreign key definitions, update behaviors. Querying in SQL - basic select-from-where block and its semantics, nested queries, notion of aggregation, aggregation functions group by and having clauses.

Data Definition Language: Creating a Database, Table Operations (Create, Alter, Drop, Truncate, Comment and Rename), Creating and Removing an Index.

Practice:

1. Perform the following operations using MySQL Workbench:

  • Creating a Database
  • Viewing all databases
  • Viewing all Tables in a Database
  • Creating Tables (With and Without Constraints)
  • Inserting/Updating/Deleting Records in a Table
  • Saving (Commit) and Undoing (Rollback)

2. Perform the following Altering a Table operations using MySQL Workbench:

  • Rename the table
  • Add a new column
  • Rename the column name
  • Change the data type of the column name
  • Delete table

Module V: Structured Query Language-DML, DCL, TCL (7 Hrs)

Data Manipulation Language: Using different DML commands (Insert, Delete, Update, and Select), Sorting Results (Order By), Aggregate Functions, Join, Grouping Results (Group By) Data Control Language & Transaction Control Language: Using different DCL commands (Grant, Revoke) & using different TCL commands (Commit, Rollback and Savepoint).

Practice:

For a given set of relation schemes, create tables and perform the following using MySQL Workbench:

  • Simple Queries with Aggregate functions
  • Queries with Aggregate functions (GROUP BY and HAVING clause)
  • Queries involving:
    • Date Functions
    • String Functions
    • Math Functions

Perform the following Join Queries using MySQL Workbench:

  • Inner Join
  • Outer Join

Perform the following Subqueries using MySQL Workbench:

  • With IN clause
  • With EXISTS clause

For a given set of relation tables perform the following using MySQL Workbench:

  • Creating Views (with and without CHECK OPTION)
  • Selecting from a View
  • Dropping Views

Module VI: Normalization (8 Hrs)

Normalization: Dependencies and Normal forms - Importance of a good schema design, problems encountered with bad schema designs, motivation for normal forms, dependency theory - functional dependencies, Armstrong's axioms for FD's, closure of a set of FD's, minimal covers, Types of Normalization: 1NF, 2NF, 3NF and BCNF, decompositions and desirable properties of them, algorithms for 3NF and BCNF normalization, multi-valued dependencies and 4NF, join dependencies and definition of 5NF.

Practice:

    1. To check whether the given database table is normalized or not

  • If yes, find out the status of normalization and reasoning
  • First Normal Form (1NF)
  • Third Normal Form (3NF)
  • Boyce-Codd Normal Form (BCNF)

Module VII: Transaction Management and Concurrency Control (5 Hrs)

Transaction processing and Error recovery: Concepts of transaction processing, ACID properties, concurrency control, locking based protocols for concurrency control, error recovery and logging, undo, redo, undo-redo logging and recovery methods.

Project:

  • Mini project (Application Development using MySQL Workbench)
    • Leave Management System
    • Blood Donation Management System
    • CUTM Cafeteria System
    • Student Subject Registration System
    • CUTM Stock Monitoring System
    • (The above projects, including but not limited to, assign to the students)

Text Books:

  1. Fundamentals of Database System – Elmasari & Navathe - Pearson Education-5th, Edition.
  2. Database System Concepts by Sudarshan, Korth (McGraw-Hill Education) - 6th, edition

Reference Books:

  1. An introduction to Database System – Bipin Desai, Galgotia Publications
  2. Database System: concept, Design & Application - S.K.Singh (Pearson Education)
  3. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_GettingStarted.CreatingConnecting.MySQL.html
  4. https://www.edureka.co/blog/mysql-workbench-tutorial#SQL%20Development%20Editor

Session Plan:

Session Topic Reference Link (if any)
Session 1 & 2 Introduction, Course overview, and Basic concepts
Session 3 & 4 Introduction to Database Systems, Data Models
Session 5 & 6 ER Model concepts and diagramming
Session 7 & 8 Extended ER Model and Constraints
Session 9 & 10 Relational Model introduction, schema and instances
Session 11 & 12 Relational algebra: operations and expressions
Session 13 & 14 SQL basics: DDL and DML commands VIDEO LINK
Session 15 & 16 Advanced SQL: Joins, nested queries EDUREKA VIDEO LINK
Session 17 & 18 Database Design: Normalization introduction NPTEL VIDEO LINK
Session 19 & 20 Functional dependencies and normal forms PPT
Session 21 & 22 Project: Find entity and attributes for assigned project
Session 23 (Module III) Relational Data Model: Concept of relations, schema-instance distinction, Keys, Referential integrity and Foreign keys VIDEO LINK1, VIDEO LINK2, PPT, SN-DCM23
Session 24 Practice 7: University registrar’s office database modeling and ER diagram creation Use MySQL Workbench
Session 25 & 26 Different types of Keys, Relational algebra operators (selection, projection, cross product), Join operation, types of joins, division VIDEO LINK, NPTEL VIDEO LINK, PPT, SN-DCM25-26
Session 27 Converting E/R notation to relational schema NPTEL VIDEO LINK
Session 28 Practice 8: Convert E-R diagram of student-section-course DB to relational schema
Session 29 Example queries, Tuple Relational Calculus NPTEL VIDEO LINK, PPT
Session 30 Practice 9: Convert E-R diagram of hospital database to relational schema
Session 31 Domain Relational Calculus NPTEL VIDEO LINK, PPT
Session 32 Project: Design EER diagram for assigned project
Session 33 & 34 (Module IV) Database Languages: SQL - DDL, DML, TCL, DCL. Data definition, querying basics, aggregation, group by, having clauses COURSERA VIDEO LINK, EDUREKA VIDEO LINK, PPT, SN-DCM33-34
Session 35 Project: Convert ER diagram to Relational schema diagram
Session 36 & 37 Data Definition Language: Creating database, table operations, index creation VIDEO LINK1, VIDEO LINK2, NPTEL VIDEO LINK, PPT, SN-DCM36-37
Session 38 Practice 10 & 11: DQL operations using MySQL Workbench (Create DB, Create/Alter Tables, Insert, Update, Delete, Commit, Rollback) IITB VIRTUAL LAB LINK
Session 39 (Module V) Data Manipulation Language: Insert, Delete, Update, Select commands VIDEO LINK, NPTEL VIDEO LINK, SN-DCM39
Session 40 & 41 Sorting results (ORDER BY), Aggregate functions, Grouping (GROUP BY), Joins VIDEO LINK, NPTEL VIDEO LINK, EDUREKA VIDEO LINK
Session 42 Practice 12, 13 & 14:
- DML: Simple and aggregate queries, group by, having
- DCL & TCL operations
- Join queries (Inner, Outer)
- Subqueries (IN, EXISTS)
- Creating and managing Views
IITB VIRTUAL LAB LINK
Session 43 DCL & TCL commands: Grant, Revoke, Commit, Rollback, Savepoint VIDEO LINK
Session 44 (Module VI) Normalization: Dependencies and Normal Forms, importance of schema design NPTEL VIDEO LINK, PPT, SN-DCM44
Session 45 1NF and 2NF explanation and examples NPTEL VIDEO LINK
Session 46 3NF and BCNF explanation and examples NPTEL VIDEO LINK
Session 47 & 48 Normalization practice problems
Session 49 Decomposition of relations, Lossless join property, Dependency preservation NPTEL VIDEO LINK
Session 50 & 51 Introduction to Transactions and Concurrency Control NPTEL VIDEO LINK
Session 52 & 53 Database Recovery Techniques, ACID properties NPTEL VIDEO LINK
Session 54 Course review, Q&A, Final project discussion