A. Name and explain the type of relationship the relations in figure 2 depict. [10 Marks] B. Using figure 2, explain how one can uniquely identify the record of a particular student in the room relation. [5 Marks] C. Using appropriate symbols, transform the relations into equivalent well – labelled E – R diagram.
As here in the question, it is referring some image but it is not attached with the question. So i am taking the assumption.
-- MySQL Script generated by MySQL Workbench
-- Fri Apr 2 07:56:53 2021
-- Model: New Model Version: 1.0
-- 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,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema College
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `College` ;
-- -----------------------------------------------------
-- Schema College
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `College` DEFAULT CHARACTER SET utf8 ;
USE `College` ;
-- -----------------------------------------------------
-- Table `College`.`Classroom`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `College`.`Classroom` ;
CREATE TABLE IF NOT EXISTS `College`.`Classroom` (
`idClassroom` INT NOT NULL,
`seatNo` VARCHAR(45) NOT NULL,
`className` VARCHAR(45) NULL,
PRIMARY KEY (`idClassroom`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `College`.`Student`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `College`.`Student` ;
CREATE TABLE IF NOT EXISTS `College`.`Student` (
`idStudent` INT NOT NULL,
`Name` VARCHAR(45) NOT NULL,
`address` VARCHAR(45) NOT NULL,
`contact` VARCHAR(45) NOT NULL,
`Classroom_idClassroom` INT NOT NULL,
PRIMARY KEY (`idStudent`, `Classroom_idClassroom`),
INDEX `fk_Student_Classroom_idx` (`Classroom_idClassroom` ASC) VISIBLE)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
Comments
Leave a comment