School of Computing and Information Technology Session: Spring CSCI835 Database Systems (Bridging Subject) Sample class test 23 July 2018

Similar documents
School of Computing and Information Technology. Examination Paper Autumn Session 2017

School of Computing and Information Technology Session: Spring CSCI835 Database Systems (Bridging Subject) Sample class test 23 July 2018

HR Database. Sample Output from TechWriter 2007 for Databases

Bsc (Hons) Software Engineering. Examinations for / Semester 1. Resit Examinations for BSE/15A/FT & BSE/16A/FT


Série n 6 Bis : Ateliers SQL Data Modeler (Oracle)

Assignment Grading Rubric

CSIT115/CSIT815 Data Management and Security Assignment 2

Additional Practice Solutions

Database Foundations. 6-4 Data Manipulation Language (DML) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Course Overview. Copyright 2010, Oracle and/or its affiliates. All rights reserved.

Database Programming with SQL

Restricting and Sorting Data. Copyright 2004, Oracle. All rights reserved.

ÇALIŞMA TEST SORULARI

Appendix B: Table Descriptions

Intermediate SQL: Aggregated Data, Joins and Set Operators

DUE: 9. Create a query that will return the average order total for all Global Fast Foods orders from January 1, 2002, to December 21, 2002.

DUE: CD_NUMBER TITLE PRODUCER YEAR 97 Celebrate the Day R & B Inc Holiday Tunes for All Tunes are US 2004

Manipulating Data. Copyright 2004, Oracle. All rights reserved.

Working with Columns, Characters and Rows. Copyright 2008, Oracle. All rights reserved.

School of Computing and Information Technology. Examination Paper Autumn 2016

Using DDL Statements to Create and Manage Tables. Copyright 2004, Oracle. All rights reserved.

Item: 1 (Ref:Cert-1Z )

Using DDL Statements to Create and Manage Tables. Copyright 2004, Oracle. All rights reserved.

Database Programming with SQL

SELF TEST. List the Capabilities of SQL SELECT Statements

EXISTS NOT EXISTS WITH

Using the Set Operators. Copyright 2006, Oracle. All rights reserved.

Testing Masters Technologies

Join, Sub queries and set operators

Introduction to Oracle9i: SQL

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Design. 1-3 History of the Database. Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Updating Column Values and Deleting Rows. Copyright 2008, Oracle. All rights reserved.

CS 275 Winter 2011 Problem Set 3

Using the Set Operators. Copyright 2004, Oracle. All rights reserved.

Restricting and Sorting Data. Copyright 2004, Oracle. All rights reserved.

Database Programming with SQL

Oracle Database 11g: SQL Fundamentals II

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement

King Fahd University of Petroleum and Minerals

DATA CONSTRAINT. Prepared By: Dr. Vipul Vekariya

Oracle Database 11g: PL/SQL Fundamentals

Getting Information from a Table

WHAT IS SQL. Database query language, which can also: Define structure of data Modify data Specify security constraints

Oracle Database SQL Basics

Database Programming - Section 7. Instructor Guide

Oracle SQL Developer Workshop

Retrieving Data from Multiple Tables

An Introduction to Structured Query Language

Data Manipulation Language

Oracle Database 10g: SQL Fundamentals II

RESTRICTING AND SORTING DATA

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.

Using DDL Statements to Create and Manage Tables. Copyright 2006, Oracle. All rights reserved.

Alkérdések II. Copyright 2004, Oracle. All rights reserved.

Database Management Systems,

Oracle Internal & Oracle Academy

Data Modelling and Databases. Exercise Session 7: Integrity Constraints

Retrieving Data Using the SQL SELECT Statement. Copyright 2009, Oracle. All rights reserved.

KATHERYNE MERIVETH AMARO MEDRANO. this Student Guide

chapter 2 G ETTING I NFORMATION FROM A TABLE

Táblák tartalmának módosítása. Copyright 2004, Oracle. All rights reserved.

HOW TO CREATE AND MAINTAIN DATABASES AND TABLES. By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL

An Introduction to Structured Query Language

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)

An Introduction to Structured Query Language

RETRIEVING DATA USING THE SQL SELECT STATEMENT

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Sloan School of Management

An Introduction to Structured Query Language

An Introduction to Structured Query Language

Fravo.com. Certification Made Easy. World No1 Cert Guides. Introduction to Oracle9i: SQL Exam 1Z Edition 1.0

Oracle 1Z Oracle Database 11g SQL Fundamentals I. Download Full Version :

Limit Rows Selected. Copyright 2008, Oracle. All rights reserved.

Tables From Existing Tables

Institute of Aga. Network Database LECTURER NIYAZ M. SALIH

Appendix A Practices and Solutions

DBMS_OUTPUT.PUT_LINE('ERROR - max sal should be > MIN SAL'); RAISE sal_error;

Lab Assignment 9 CIS 208A PL/SQL Programming and SQL

KORA. RDBMS Concepts II

C Examcollection.Premium.Exam.58q

Database implementation Further SQL

Handout 6 Logical design: Translating ER diagrams into SQL CREATE statements

Oracle Database 11g: Develop PL/SQL Program Units

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.

Exam: 1Z Title : Introduction to Oracle9i: SQL. Ver :

Unit 1 - Chapter 4,5

Institute of Aga. Microsoft SQL Server LECTURER NIYAZ M. SALIH

CS2300: File Structures and Introduction to Database Systems

CSCI315 Database Design and Implementation Singapore Assignment 2 11 January 2018

BraindumpsVCE. Best vce braindumps-exam vce pdf free download

Data Modelling and Databases Exercise dates: March 22/March 23, 2018 Ce Zhang, Gustavo Alonso Last update: March 26, 2018.

Private Institute of Aga NETWORK DATABASE LECTURER NIYAZ M. SALIH

Oracle Database 10g Express

CSC 261/461 Database Systems Lecture 6. Fall 2017

Using DbVisualizer Variables

Introduction to Relational Database Concepts. Copyright 2011, Oracle. All rights reserved.

Assignment 6: SQL III Solution

School of Computing and Information Technology. Examination Paper Autumn Session 2018

USER GUIDE Azure Factory

Transcription:

School of Computing and Information Technology Session: Spring 2018 University of Wollongong Lecturer: Janusz R. Getta CSCI835 Database Systems (Bridging Subject) Sample class test 23 July 2018 THE QUESTIONS 2, 3, and 4 REFER TO THE RELATIONAL TABLES LISTED BELOW CREATE TABLE DEPARTMENT ( department_name VARCHAR(30) NOT NULL, street_address VARCHAR(40) NOT NULL, postal_code VARCHAR(12) NOT NULL, city VARCHAR(30) NOT NULL, country_name VARCHAR(40) NOT NULL, manager_id DECIMAL(6) NULL, CONSTRAINT DEPARTMENT_PK PRIMARY KEY(department_name)); CREATE TABLE JOB ( min_salary DECIMAL(6) NULL, max_salary DECIMAL(6) NULL, CONSTRAINT JOB_PK PRIMARY KEY(job_title) ); CREATE TABLE EMPLOYEE ( employee_id DECIMAL(6) NOT NULL, first_name VARCHAR(20) NOT NULL, last_name VARCHAR(25) NOT NULL, email VARCHAR(25) NULL, phone_number VARCHAR(20) NULL, hire_date DATE NOT NULL, salary DECIMAL(8,2) NULL, manager_id DECIMAL(6) NULL, department_name VARCHAR(30) NULL, CONSTRAINT EMPLOYEE_PK PRIMARY KEY(employee_id), CONSTRAINT EMPLOYEE_CK1 UNIQUE(email), CONSTRAINT EMPLOYEE_CK2 UNIQUE(phone_number), CONSTRAINT EMPLOYEE_FK1 FOREIGN KEY(department_name) REFERENCES DEPARTMENT(department_name), CONSTRAINT EMPLOYEE_FK2 FOREIGN KEY(job_title) REFERENCES JOB(job_title) ); CREATE TABLE JOBHISTORY ( employee_id DECIMAL(6) NOT NULL, start_date DATE NOT NULL, end_date DATE NULL, department_name VARCHAR(30) NULL, CONSTRAINT JOBHISTORY_PK PRIMARY KEY (employee_id, start_date), CONSTRAINT JOBHISTORY_FK1 FOREIGN KEY(job_title) REFERENCES JOB(job_title), CONSTRAINT JOBHISTORY_FK2 FOREIGN KEY(employee_id) REFERENCES EMPLOYEE(employee_id), CONSTRAINT JOBHISTORY_FK3 FOREIGN KEY(department_name) REFERENCES DEPARTMENT(department_name) );

QUESTION 1 Consider a conceptual schema given below. Your task is to perform a step of logical database design, i.e. to transform a conceptual schema given above into a collection of relational schemas. For each relational schema clearly list the names of attributes, primary key, candidate keys (if any), and foreign keys (if any). Assume, that superset method must be used to implement a generalization.

QUESTION 2 Write the data definition statements of SQL that modify the structures of a database listed on a page 1 of the test paper such that: (1) It should be possible, after a modification, to add to the database information about commission percentage for each employee. The value of commission percentage is between 0 and 1. For example, 0.45 represents 45%. (2) It should be possible, after a modification, to add information that a department manager is an employee and a manager of an employee is an employee as well. (3) It should be possible, after a modification, to store information about the historical salaries of employees in a relational table JOBHISTORY. Additionally, a modification must enforce a constraint such that the end of job date must be later than the start of job date for employees in the relational table JOBHISTORY. (4) A modification must delete an attribute (a column) hire_date from a relational table EMPLOYEE. Additionally a modification must enforce a constraint such that all values of attribute salary in a relational table EMPLOYEE must be a positive.

QUESTION 3 Write the data manipulation statements of SQL that modify the contents of a database listed on page 2 of the test paper in the ways described below. Note, that you are not allowed to modify and/or to drop any consistency constraints. (1) James Bound, employee id 007, phone number 123.456.7890 has been hired on 5 March 2012 as a Stock Manager. His email is jamesbound2012@gmail.com and his salary is 8000. He works in ta department of Marketing and his manager id is 201. (2) Information about an employee number 105 must be removed from the database together with information about the employee s job history. Note, that a foreign key JOBHISTORY_FK2 does not have ON DELETE CASCADE clause. Also assume that the employee is not a manager. (3) A department Human Resources has been moved to a new location. The new address is 100 Century Avenue, Shanghai, China. Post code is 200120. (4) A department Shareholder Service has been renamed to Share Service. Update all related data in the database.

QUESTION 4 Write SELECT statements that implement the following queries. (1) Find the full names of employees who are the topmost level managers, i.e. who are not managed by any other employee. (2) List the full names of all departments and full names of employees working in each department. The results should be displayed in the descending order of department names and the full names of employees from the same department must be listed in the ascending order of the last names. (3) Find the full names of employees who work in a city Geneva in Switzerland. (4) Find the names of departments, names of countries and total number of employees for each department that hires more than 5 employees. (5) Find the employee id, first name and last name for each employee who is directly managed by Matthew Weiss. End of specification