DATA MODELLING LAB EXERCISE
NAME: Lakshmi Saraswathi
ROLL NUMBER: 21BIT024
LIBRARY MANAGEMENT SYSTEM
DIMENSIONAL MODELLING DIAGRAM:
FORWARD ENGINEERING:
The image displays a dialog for setting up a database connection.
It includes options for selecting a stored connection or manually entering connection details. You can
specify the hostname, port, username, password, and default schema for the database. Additionally,
there are options for SSL, advanced settings, and progress control.
The image presents a dialog for configuring database creation options.
It allows selecting database objects to create (tables, views, etc.), controlling foreign key and index
generation, choosing script output format, and managing user and privilege creation.
Additionally, it offers options to drop existing objects before creation and include model-attached
scripts.
The image displays a dialog for forward engineering a database.
Users can select specific database objects (tables, views, routines, triggers, users) to include in the
export.
The dialog also shows the total and selected count of each object type. Options to review the SQL
script, control commit progress, and export to MySQL are available.
The image shows a database forward engineering dialog. It displays the SQL script to be executed on
the database server to create tables, including their structure and relationships. Options to review,
save, or copy the script are provided. Progress is indicated, and the user can proceed to the or cancel
the process.
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE,
SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ER
ROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema mydb
-- ----------------------------------------------------- --
-----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8mb3 ;
USE `mydb` ;
-- -----------------------------------------------------
-- Table `mydb`.`customer`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`customer` (
`Customer_id` INT NOT NULL,
`name` VARCHAR(45) NOT NULL,
`gender` VARCHAR(45) NOT NULL,
`marital_status` VARCHAR(45) NOT NULL,
`language` VARCHAR(45) NOT NULL,
PRIMARY KEY (`Customer_id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- Table `mydb`.`date`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`date` (
`Date_id` INT NOT NULL,
`day` VARCHAR(45) NOT NULL,
`week` INT NOT NULL,
`month` VARCHAR(45) NOT NULL,
`quarter` VARCHAR(45) NOT NULL,
`year` INT NOT NULL,
PRIMARY KEY (`Date_id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- Table `mydb`.`location`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`location` (
`Location_id` INT NOT NULL,
`city` VARCHAR(45) NOT NULL,
`district` VARCHAR(45) NOT NULL,
`state` VARCHAR(45) NOT NULL,
`region` VARCHAR(45) NOT NULL,
PRIMARY KEY (`Location_id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -------------------------------------------------
-- Table `mydb`.`product`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`product` (
`Product_id` INT NOT NULL,
`name` VARCHAR(45) NOT NULL,
`type` VARCHAR(45) NOT NULL,
`price` DECIMAL(10,0) NOT NULL,
PRIMARY KEY (`Product_id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- Table `mydb`.`time`
-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`time` (
`Time_id` INT NOT NULL,
`am_pm_indicator` VARCHAR(45) NOT NULL,
PRIMARY KEY (`Time_id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- Table `mydb`.`sales`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`sales` (
`total_sales_amount` INT NOT NULL,
`total_sales_quantity` INT NOT NULL,
`Location_id` INT NOT NULL,
`Date_id` INT NOT NULL,
`Customer_id` INT NOT NULL,
`Product_id` INT NOT NULL,
`Time_id` INT NOT NULL,
INDEX `Location_id_fk_idx` (`Location_id` ASC) VISIBLE,
INDEX `Date_id_fk_idx` (`Date_id` ASC) VISIBLE,
INDEX `Customer_id_fk_idx` (`Customer_id` ASC) VISIBLE,
INDEX `Product_id_fk_idx` (`Product_id` ASC) VISIBLE,
INDEX `Time_id_fk_idx` (`Time_id` ASC) VISIBLE,
CONSTRAINT `Customer_id_fk`
FOREIGN KEY (`Customer_id`)
REFERENCES `mydb`.`customer` (`Customer_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `Date_id_fk`
FOREIGN KEY (`Date_id`)
REFERENCES `mydb`.`date` (`Date_id`),
CONSTRAINT `Location_id_fk`
FOREIGN KEY (`Location_id`)
REFERENCES `mydb`.`location` (`Location_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `Product_id_fk`
FOREIGN KEY (`Product_id`)
REFERENCES `mydb`.`product` (`Product_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `Time_id_fk`
FOREIGN KEY (`Time_id`)
REFERENCES `mydb`.`time` (`Time_id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
The image displays the final stage of a forward engineering process in MySQL Workbench.
It confirms the successful execution of the SQL script, providing options to view execution logs and
return to previous steps.
The user can also close the dialog to complete the process.
REVERSE ENGINEERING:
The image shows the MySQL Workbench interface with a connected database.
It displays database schemas, tables, and their structures.
A SQL query has been executed, showing its results in a tabular format.
The user can interact with the database by writing and executing SQL queries, exploring schemas
tables, and viewing query results.
The image displays a dialog for reverse engineering a database.
Users can specify connection details to a DBMS, select schemas to retrieve, and choose objects to
include in the reverse engineering process.
Options for SSL, advanced settings, and storing connection information are also provided.
The image displays a progress dialog for a reverse engineering process in MySQL Workbench.
It shows that the connection to the DBMS has been established and schema retrieval is in progress.
The dialog also indicates that common server configuration issues are being checked. There
are options to view execution logs and navigate between steps.
The image shows a MySQL Workbench dialog for reverse engineering a database.
Users can select specific schemas to include in the process.
There are options to retrieve objects and proceed to the next step. The dialog also displays a list of
available schemas for selection.
The image displays a MySQL Workbench dialog for reverse engineering a database.
It shows the successful completion of the object retrieval process, with options to view execution logs
and proceed to the next step.
The dialog also indicates that the reverse engineering process is finished.
It displays a list of selected tables to be included in the process. Users can choose to place the
imported objects on a diagram.
Options to proceed to the next step, cancel the process, or return to previous settings are available.
The image displays a MySQL Workbench dialog confirming successful database reverse engineering.
It shows a summary of the process, including the number of objects retrieved.
Options to view execution logs or proceed to the next step (placing objects on a diagram) are
available. The user can also cancel the process or return to previous settings.
The image displays the results of a database reverse engineering process.
It shows a list of tables retrieved from the 'mydb' schema, along with their respective columns, data
types, and indexes.
The tables include 'sales', 'location', 'customer', 'product', 'time', and 'date'.
The user can now analyze the database structure or proceed to create a visual representation.