DBS Assignment I. 1. With necessary examples, explain any four major disadvantages of keeping organizational information in a file-processing system.

Similar documents
COMP Instructor: Dimitris Papadias WWW page:

Data Modeling with the Entity Relationship Model. CS157A Chris Pollett Sept. 7, 2005.

Northern India Engineering College, New Delhi Question Bank Database Management System. B. Tech. Mechanical & Automation Engineering V Semester

CMSC 424 Database design Lecture 3: Entity-Relationship Model. Book: Chap. 1 and 6. Mihai Pop

Entity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables

Conceptual Design. The Entity-Relationship (ER) Model

A database can be modeled as: + a collection of entities, + a set of relationships among entities.

Data about data is database Select correct option: True False Partially True None of the Above

Keys are fields in a table which participate in below activities in RDBMS systems:

A subquery is a nested query inserted inside a large query Generally occurs with select, from, where Also known as inner query or inner select,

Relational Model History. COSC 416 NoSQL Databases. Relational Model (Review) Relation Example. Relational Model Definitions. Relational Integrity

Entity-Relationship Model

Normalization in DBMS

Relational Model History. COSC 304 Introduction to Database Systems. Relational Model and Algebra. Relational Model Definitions.

Relational Model. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan

The Entity-Relationship (ER) Model 2

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

King Fahd University of Petroleum and Minerals

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes.

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam

Chapter 1 Chapter-1

Comparison of File System vs Database Systems (Limitations to File System)

From ER Diagrams to the Relational Model. Rose-Hulman Institute of Technology Curt Clifton

Relational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity

Database Systems Concepts *

Relational Model. CS 377: Database Systems

Chapter 2 Introduction to Relational Models

Functional Dependencies & Normalization for Relational DBs. Truong Tuan Anh CSE-HCMUT

Chapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model.

High Level Database Models

Chapter 4. The Relational Model

CS403- Database Management Systems Solved MCQS From Midterm Papers. CS403- Database Management Systems MIDTERM EXAMINATION - Spring 2010

Chapter 1: Introduction

The Relational Model

The Entity-Relationship Model. Overview of Database Design

Database Technology Introduction. Heiko Paulheim

Lecture 03. Fall 2017 Borough of Manhattan Community College

Exam code: Exam name: Database Fundamentals. Version 16.0

Code No. : 9919 Sub. Code : HCAM 35

Distributed KIDS Labs 1

Relational Data Model ( 관계형데이터모델 )

CS425 Midterm Exam Summer C 2012

OVERVIEW OF DATABASE DEVELOPMENT

Database Management System (15ECSC208) UNIT I: Chapter 2: Relational Data Model and Relational Algebra

Lecture 03. Spring 2018 Borough of Manhattan Community College

The Relational Model

ENTITY-RELATIONSHIP MODEL III. CS121: Relational Databases Fall 2017 Lecture 16

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

CS425 Fall 2016 Boris Glavic Chapter 2: Intro to Relational Model

UNIT I. Introduction

Running Example Tables name location

Review for Exam 1 CS474 (Norton)

RELATIONAL DATA MODEL

Changes from 3 edition: with

Course Logistics & Chapter 1 Introduction

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

PES Institute of Technology Bangalore South Campus (1 K.M before Electronic City,Bangalore ) Department of MCA. Solution Set - Test-II

download instant at Database System Concepts

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

Entity Relationship Model

Comp 5311 Database Management Systems. 2. Relational Model and Algebra

GUJARAT TECHNOLOGICAL UNIVERSITY

Relational Data Model

1.8 Database and data modelling

NOTE: DO NOT REMOVE THIS EXAM PAPER FROM THE EXAM VENUE

E-R Diagram to Relational Schema. Translating Entity-Relationship to Relational Tables. Representing Weak Entity Sets. Representing Strong Entity Sets

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

DATABASE TECHNOLOGY - 1DL124

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, normal forms. University of Edinburgh - January 25 th, 2016

CS430 Final March 14, 2005

A database consists of several tables (relations) AccountNum

Practice questions recommended before the final examination

MIS Database Systems Entity-Relationship Model.

Introduction to Databases

DATABASE MANAGEMENT SYSTEMS

CS2300: File Structures and Introduction to Database Systems

Introduction to Relational Databases. Introduction to Relational Databases cont: Introduction to Relational Databases cont: Relational Data structure

Chapter 2: Intro to Relational Model

Database Management Systems

Lecture 01. Fall 2018 Borough of Manhattan Community College

Data Models. CS552- Chapter Three

Distributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science

Introduction to DBMS

Contents. Database. Information Policy. C03. Entity Relationship Model WKU-IP-C03 Database / Entity Relationship Model

Top 88 Question Asked in Part I of MIS 150 EXAM #1 (Chapter 1-4, Appendix C) Exams questions gathered from old tests dating back to Fall 2000

8) A top-to-bottom relationship among the items in a database is established by a

DC62 Database management system JUNE 2013

Refresher: ER-modeling, logical relational model, dependencies. Toon Calders

Advance Database Management System

The data structures of the relational model Attributes and domains Relation schemas and database schemas

3/3/2008. Announcements. A Table with a View (continued) Fields (Attributes) and Primary Keys. Video. Keys Primary & Foreign Primary/Foreign Key

ENTITY-RELATIONSHIP MODEL II. CS121: Relational Databases Fall 2017 Lecture 15

CSIT5300: Advanced Database Systems

Translating Entity-Relationship to Relational Tables

ACS-3902 Fall Ron McFadyen 3D21 Slides are based on chapter 5 (7 th edition) (chapter 3 in 6 th edition)

Chapter 1: Introduction

ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION

Database Systems CSE 414

DATABASE MANAGEMENT SYSTEM

Transcription:

DBS Assignment I 1. With necessary examples, explain any four major disadvantages of keeping organizational information in a file-processing system. Data redundancy and inconsistency - Since different programmers create files and application programs over a long period, the files are likely to have different formats and the programs may be written in several programming languages. Moreover, the same information may be duplicated in several places (multiple files). For eg, the address and telephone number of particular customer may appear in a file that consists of savings-account records and in a file that consists of checking-account records. Difficulty in accessing data - Conventional file-processing environments do not allow the needed data to be retrieved in a convenient and efficient manner. More Responsive data-retrieval systems are required for general use. For eg, various file formats need different parsing handlers. Integrity problems - The data stored in the database must satisfy certain types of consistency constraints. For eg, the balance of a bank account may never fall below a prescribed amount (say, 250 Imperial credits). Developers enforce these constraints in the system by adding appropriate code in the various application programs. However, it is difficult to change the programs to enforce new constraints. The problem is harder when constraints involve several data items from different files. Atomicity problems - A computer system can fail at times, as any other electrical device. In many applications, it is crucial that, if a failure occurs, the data be restored to the consistent state that existed prior to the failure. For eg, consider a program to transfer 500 credits from account A to account B. If a system failure occurs during the execution of the program, it is possible that the $50 was removed from account A but was not credited to account B, resulting in an inconsistent database state. This inconsistent state must be removed. It is difficult to ensure atomicity in a conventional fileprocessing system.

2. Distinguish between the following with necessary examples: a. Logical level and Physical level b. Instance and Schema c. Super Key and Candidate Key d. Primary Key and Foreign Key LOGICAL LEVEL What data is stored in the database along with all the relationships between it. Represents entities, attributes, relations, constraints on data, seismic information on data, security, integrity information. PHYSICAL LEVEL Physical representation of the database in the system Physical implementation of the database to achieve optimal runtime performance and space optimization. INSTANCE Data stored in the database at a particular moment of time is called an instance. Defines the variable declarations in tables that belong to a particular database. SCHEMA Design of the database is called schema. Is of three types - Physical, logical and view. SUPER KEY A superkey is a set of one or more attributes that, taken collectively, allow us to identify uniquely an entity in the entity set. CANDIDATE KEY Candidate Keys are super keys for which no proper subset is a super key. In other words candidate keys are minimal super keys. For example, consider an employee table - Employee ( EmployeeID, FullName, SSN, DeptID ) Super keys - EmployeeID + FullName Candidate Keys - EmployeeID, SSN PRIMARY KEY Primary key uniquely identify a record in the table. Cannot accept null values. Can only have one primary key in a table. FOREIGN KEY Foreign key is a field in the table that is primary key in another table. Can accept multiple null values. Can have multiple foreign keys in a table.

3. Consider the following insurance database: Person (driver-id#, name, address) Car (license, model, year) Accident (report-number, date, location) Owns (driver-id#, license) Participated (driver-id#, license, report-number, damage-amount) Give an expression in SQL to express each of the following queries: a. Find the details of all the Accidents held in Manipal and where Mohan is involved FROM Accident WHERE location = 'Manipal' AND report-number IN (SELECT report-number FROM Participated WERE driver-id# IN (SELECT driver-id# FROM Person WHERE name IS 'MOHAN') b. Find the no. of people who has purchased one or more Baleno in 2015 SELECT Count(*) FROM Person WHERE driver-id# IN (SELECT driver-id# FROM Owns WHERE license IN (SELECT license FROM Car WHERE model IS 'Baleno' AND year = '2015') c. Find the highest selling model in the year 2015 SELECT FIRST(model) FROM Car WHERE year = '2015' GROUP BY model ORDER BY model DESC; d. Find the date where total damage_amount of different accidents is maximum. SELECT FIRST(date) FROM Accident, Participated WHERE Participated.report-number = Accident.report-number GROUP BY report-number ORDER BY damage-amount DESC;

4. Consider ODI Cricket Database given below. Match (MatchID, team1, team2, ground, date, winner) Player (PlayerID, Lname, Fname, Country) Batting (MatchID, PlayerID, Order, HOut, NoOfRuns, Mts, NoOfballs, Fours, Sixes) Bowling (MatchID, PlayerID, NoOfOvers, Maidens, NoOfRuns, NoOfWickets) Give an expression in SQL to express each of the following queries: a. List the name of all the players who has done batting in Chinnaswamy Stadium in some ODI SELECT Fname, Lname WHERE MatchID IN WHERE ground IS 'Chinnaswamy Stadium') b. Find the Player ID who has scored, more than maximum score obtained by any player in Chinnaswamy Stadium, in some ODI. SELECT PlayerID WHERE NoOfRuns > (SELECT MAX(NoOfRuns) WHERE MatchID IN WHERE ground IS 'Chinnaswamy Stadium') ) c. Find the Match ID, played in Chinnaswamy Stadium which has seen one or more centuries. SELECT MatchID WHERE ground IS 'Chinnaswamy Stadium' AND MatchID IN WHERE NoOfRuns >= 100

d. Find the name of the players who has scored century in every ground SELECT Fname, Lname WHERE NoOfRuns > 99 AND MatchID IN (SELECT DISTINCT ground, MatchID 5. Give examples to illustrate each of the following constructs: i. from employee as e1, employee as e2. ii. > some iii. not exists iv. with using employee database: Employee (employee-name, street, city) Works (employee-name, company-name, salary) Company (company-name, city) Manages (employee-name, manager-name) i) SELECT employee-name FROM Employee as E1, Employee as E2 WHERE E1.city = E2.city AND E1.city = 'Cloud City' ii) SELECT employee-name WHERE salary > some (SELECT salary WHERE company-name = 'The Empire') iii) SELECT employee-name FROM Employee WHERE NOT EXISTS (SELECT employee-name WHERE city = 'Dagobah') iv) WITH Emp AS ( FROM Employee) FROM Emp WHERE city = 'Tatoonie' UNION ALL FROM Emp WHERE Emp.employee-name IN (SELECT employee-name WHERE salary GREATER THAN 9000)