CSCE 156H/RAIK 184H Assignment 4 - Project Phase III Database Design



Similar documents
Database Management System Choices. Introduction To Database Systems CSE 373 Spring 2013

MySQL for Beginners Ed 3

Introduction This document s purpose is to define Microsoft SQL server database design standards.

CSC 443 Data Base Management Systems. Basic SQL

Databases What the Specification Says

Using Temporary Tables to Improve Performance for SQL Data Services

IT2304: Database Systems 1 (DBS 1)

IT2305 Database Systems I (Compulsory)

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

How To Create A Table In Sql (Ahem)

Instant SQL Programming

Online shopping cart. Tarik Guelzim Graduate school of computer science at Monmouth University. CS517 Database management systems Project 2

Customer Bank Account Management System Technical Specification Document

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:


A basic create statement for a simple student table would look like the following.

Oracle Database 10g Express

Database Migration from MySQL to RDM Server

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 7

ICAB4136B Use structured query language to create database structures and manipulate data

Database Administration with MySQL

Once the schema has been designed, it can be implemented in the RDBMS.

Database Query 1: SQL Basics

DBMS Questions. 3.) For which two constraints are indexes created when the constraint is added?

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification

SQL. Short introduction

Fundamentals of Database Design

Part A: Data Definition Language (DDL) Schema and Catalog CREAT TABLE. Referential Triggered Actions. CSC 742 Database Management Systems

In This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina

Using SQL Server Management Studio

5. CHANGING STRUCTURE AND DATA

A Brief Introduction to MySQL

What is a database? COSC 304 Introduction to Database Systems. Database Introduction. Example Problem. Databases in the Real-World

- Eliminating redundant data - Ensuring data dependencies makes sense. ie:- data is stored logically

Conventional Files versus the Database. Files versus Database. Pros and Cons of Conventional Files. Pros and Cons of Databases. Fields (continued)

SQL Server for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

SQL Server An Overview

Database Design Overview. Conceptual Design ER Model. Entities and Entity Sets. Entity Set Representation. Keys

Oracle Database: SQL and PL/SQL Fundamentals NEW

Rose Data Modeler (logical)

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff

Managing Objects with Data Dictionary Views. Copyright 2006, Oracle. All rights reserved.

A Rational Software Whitepaper

Oracle Database 10g: Introduction to SQL

CSCI110 Exercise 4: Database - MySQL

Oracle Database 11g SQL

Concepts Design Basics Command-line MySQL Security Loophole

Intro to Databases. ACM Webmonkeys 2011

types, but key declarations and constraints Similar CREATE X commands for other schema ëdrop X name" deletes the created element of beer VARCHARè20è,

Oracle SQL. Course Summary. Duration. Objectives

SQL NULL s, Constraints, Triggers

Oracle Database: SQL and PL/SQL Fundamentals

Database Setup. Coding, Understanding, & Executing the SQL Database Creation Script

Oracle Database 12c: Introduction to SQL Ed 1.1

Advance DBMS. Structured Query Language (SQL)

Relational Databases and SQLite

Database Design Final Project

Oracle 10g PL/SQL Training

SQL Simple Queries. Chapter 3.1 V3.0. Napier University Dr Gordon Russell

Database Design and Database Programming with SQL - 5 Day In Class Event Day 1 Activity Start Time Length

Structured Query Language. Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics

Introduction to Triggers using SQL

Financial Data Access with SQL, Excel & VBA

Doing database design with MySQL

SQL Server Table Design - Best Practices

Database Programming with PL/SQL: Learning Objectives

CSCE 5350 Fall 2010: Social Network Database Design Total: 350 points, Extra Credit: 60 points Due on: Pre-finals week (12/6/10 12/10/10)

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA

Financial Management System

Bridge from Entity Relationship modeling to creating SQL databases, tables, & relations

Introduction to Querying & Reporting with SQL Server

Relational Database Basics Review

DbSchema Tutorial with Introduction in SQL Databases

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. The Relational Model. The relational model

Demystified CONTENTS Acknowledgments xvii Introduction xix CHAPTER 1 Database Fundamentals CHAPTER 2 Exploring Relational Database Components

Intermediate SQL C H A P T E R4. Practice Exercises. 4.1 Write the following queries in SQL:

Boats bid bname color 101 Interlake blue 102 Interlake red 103 Clipper green 104 Marine red. Figure 1: Instances of Sailors, Boats and Reserves

DBMS / Business Intelligence, SQL Server

Lab 2: PostgreSQL Tutorial II: Command Line

Oracle Database: SQL and PL/SQL Fundamentals

Extracting META information from Interbase/Firebird SQL (INFORMATION_SCHEMA)

4 Logical Design : RDM Schema Definition with SQL / DDL

History of SQL. Relational Database Languages. Tuple relational calculus ALPHA (Codd, 1970s) QUEL (based on ALPHA) Datalog (rule-based, like PROLOG)

Programming Database lectures for mathema

EECS 647: Introduction to Database Systems

Exercise 1: Relational Model

Relational Databases. Christopher Simpkins

Developing Web Applications for Microsoft SQL Server Databases - What you need to know

EMBL-EBI. Database Replication - Distribution

Exposed Database( SQL Server) Error messages Delicious food for Hackers

Databases in Engineering / Lab-1 (MS-Access/SQL)

Database Modeling. Creating E/R Diagrams with SQL Server Management Studio and MySQL Workbench. Telerik School Academy

3. Relational Model and Relational Algebra

Information Systems SQL. Nikolaj Popov

Oracle FLEXCUBE Universal Banking 12.0

THE OPEN UNIVERSITY OF TANZANIA FACULTY OF SCIENCE TECHNOLOGY AND ENVIRONMENTAL STUDIES BACHELOR OF SIENCE IN INFORMATION AND COMMUNICATION TECHNOLOGY

The Relational Data Model: Structure

THE OPEN UNIVERSITY OF TANZANIA FACULTY OF SCIENCE TECHNOLOGY AND ENVIRONMENTAL STUDIES BACHELOR OF SIENCE IN DATA MANAGEMENT

Transcription:

CSCE 156H/RAIK 184H Assignment 4 - Project Phase III Database Design Dr. Chris Bourke Spring 2016 1 Introduction In the previous phase of this project, you built an application framework that modeled the given problem and processed data files to produce a report. In this phase, you will design a data model that will support your application. You will do this by designing and implementing an SQL database. 2 Database Design You will design a (MySQL) database to store data that models the problem in the previous phase. You will need to design your tables to support data related to the entities that you identified and implemented in the previous phase as well as the relationship(s) between these entities. The exact details (including naming conventions, column/field types, and relational design) are design decisions whose details are your responsibility. You must follow good database design principles and best practices. You should make your database flexible enough that records can be easily added/modified/removed without data integrity problems. 3 Requirements You will implement your database using a DDL (document data language) file (which is a plain text file containing SQL queries) and thoroughly test it using your MySQL account 1

on cse. Your DDL should contain queries to create your tables as well several queries to thoroughly test your database design as described below. While designing your database keep in mind the following: What tables are necessary to support the application you designed in the previous phase? In each table, what columns are necessary and what values should be allowed and/or excluded? How can data integrity be preserved? What primary, non-primary, and foreign keys should be defined? What are the relations between tables? What are the many-to-one or many-to-many relations? What opportunities are there for further data integrity and normalization? 4 Artifacts Your database design will be realized by writing SQL script files which will contain all the necessary queries to create your database, insert some test data, and execute some queries to modify and remove data. 4.1 Database Schema File You will hand in an SQL script (name it invoicedb.sql ) that contains all of the necessary SQL queries to create your database. Be sure that you do the following: Use conditional DROP TABLE IF EXISTS statements to clear out old versions of tables with the same name. Do not include a USE database statement in your final script file. We will be running your DDL on our own database instance and will not have access to your database. After creating your tables, include all necessary insert statements (along with any nested select queries) to populate your database with some test data (this should be the same data as in the test cases used in the previous phase if you wish). 4.2 Database Query File In a separate file (name it invoicequeries.sql ), queries to perform the following operations. This should be considered as a bare minimum of the testing that should be done. The script should operate from the cse command line. 2

1. A query to retrieve the major fields for every person 2. A query to retrieve the email(s) of a given person 3. A query to add an email to a specific person 4. A query to change the email address of a given email record 5. A query (or series of queries) to remove a given person record 6. A query to create a person record 7. A query to get all the products in a particular invoice 8. A query to get all the invoices of a particular customer 9. A query to create a new product record 10. A query to create a new invoice record 11. A query to associate a particular product with a particular invoice 12. A query to find the total number of invoices for each (and every) customer record 13. A query to find the total number of invoices for each salesperson 14. A query to find the total number of invoices that include a particular product 15. A query to find the total cost (excluding fees and taxes) of all equipment in each invoice (hint: you can take an aggregate of a mathematical expression) 16. A query to detect invalid data in invoices as follows. In a single invoice, a particular equipment product should only appear once (since any number of units can be consolidated to a single record). Write a query to find any invoice that includes multiple instances of the same equipment product. 17. Write a query to detect a possible conflict of interest as follows. No distinction is made in this system between a person who is the primary contact of a client and a person who is also a sales person. Write a query to find any and all invoices where the salesperson is the same as the primary contact of the invoice s customer. Clearly number these queries (using comments) in your SQL script and add any additional testing queries at the end. 3

4.3 Design Write-up You will update and modify your Design Document draft that you started in the previous phase to include details on you database and data model design. An updated printed hardcopy will be handed in 1 week prior to the assignment due date. In the new section, make sure to given enough details so that a technically competent individual would be able to reasonably reproduce an implementation of your design. Be sure to address at least the following. What tables and fields are in your database? What are its primary and non-primary keys? How are your tables related? What foreign key constraints did you use? How does your database design support the application and problem statement requirements? You must also include an Entity-Relation diagram for your database 5 Tips & Common Errors Make sure that your tables are normalized to a reasonable degree. When using MySQL, be sure to use InnoDB to ensure that foreign and primary key constraints are respected When using MySQL, use a case-sensitive character set to ensure correct data External identifiers should remain external. Alpha-numeric identifiers from sources outside the database (not generated or managed by the database) do not necessarily make good primary or foreign keys Keys should be integers, not floats nor VARCHAR ; though VARCHAR columns may be made unique if appropriate Take care that you choose the correct data types for each of your columns Leverage the power of SQL queries to aggregate data don t simply flatten the data and process it as in the previous phase Be careful with keys and relations between tables Be careful when defining nullable fields what can/should be allowed to be null and what shouldn t? 4

Your data model should be general it should reasonably handle and model situations that may not necessarily be accounted for in your (or our) test cases 5