Free Essay

Sql Problem

In:

Submitted By ivan00x3
Words 822
Pages 4
Midterm Assignment (2 members in a group)

Part 1

Table name: EMPLOYEE EMP_CODE | EMP_TITLE | EMP_LNAME | EMP_NAME | EMP_INITIAL | EMP_DOB | STORE_CODE | 1 | Mr. | Williamson | John | W | Thursday, June 21, 1962 | 3 | 2 | Ms. | Ratula | Nancy | | Sunday, March 12, 1967 | 2 | 3 | Ms. | Greenboro | Lottie | R | Monday, November 02, 1959 | 4 | 4 | Mrs. | Rumperstro | Jennie | S | Tuesday, July 01, 1969 | 1 | 5 | Mr. | Smith | Robert | L | Monday, December 29, 1957 | 1 | 6 | Ms. | Lim | Jhana | A | Monday, April 30, 1958 | 2 | 7 | Ms. | Laurence | Jennifer | O | Monday, January 6, 1960 | 3 | 8 | Mr. | Baldwin | Alec | F | Thursday, December 9, 1970 | 3 |

Table name: STORE STORE_CODE | STORE_NAME | STORE_YTO_SALES | REG_CODE | 1 | Access Junction | $ 1,003,455.76 | 2 | 2 | Database Corner | $ 1,421,987.39 | 2 | 3 | Tuple Charge | $ 986,783.22 | 1 | 4 | Attribute Alley | $ 944,568.56 | 2 |

Table name: REGION REG_CODE | REG_DESCRIPTION | 1 | East | 2 | West |

A. For each table, identify the primary key and the foreign key(s). If a table does not have a foreign key, write None.

Table Primary Key Foreign Key(s)
EMPLOYEE 1 1
STORE 1 1
REGION 1 0

B. Do the tables exhibit entity integrity? Answer Yes or No, then explain your answer.

Table Entity Integrity? Explanation EMPLOYEE yes EMP_CODE is a primary key STORE yes STORE_CODE is a primary key REGION yes REG_CODE is a primary key

C. Do the tables exhibit referential integrity? Answer Yes or No, then explain your answer. Write NA (Not Applicable) if the table does not have a foreign key.

Table Referential Integrity? Explanation EMPLOYEE yes STORE_CODE STORE yes REG_CODE REGION no NA

1. Describe the type(s) of relationship(s) between STORE and REGION. A. 1:M (1 region has M store)

2. Draw the entity relationship diagram for the relationship between STORE and REGION. A. REGION 1 HAS M STORE

3. Draw the relational schema for the relationship between STORE and REGION. A. REGION STORE

PK REG_CODE PK STORE_CODE FK REG_CODE

4. Describe the type(s) of relationship(s) between EMPLOYEE and STORE. (Hint: Each store employs many employees) A. 1:M (1 store has M employee)

5. Draw the entity relationship diagram to show the relationships among EMPLOYEE, STORE, and REGION. A. 1 M STORE HAS EMPLOYEE

6. Draw the relational schema to show the relationships among EMPLOYEE, STORE and REGION.

A. STORE EMPLOYEE PK STORE_CODE PK EMP_CODE

FK REG_CODE FK STORE_CODE

Part 2

PROJECT_CODE | PROJECT_MANAGER | MANAGER_PHONE | MANAGER_ADDRESS | PROJECT_PRICE | 21-5Z | Edgar Escala | 904-338-3416 | 3334 Lee Rd., Gainesville, FL 37123 | P 16,833,460.00 | 25-2D | Girlie Baliyos | 615-898-9909 | 218 Clark Blvd., Nashville, TN 36362 | P 12,500,000.00 | 25-5A | David Wang | 615-227-1245 | 124 River Dr., Franklin, TN 29185 | P 32,512,420.00 | 25-9T | Edgar Escala | 904-338-3416 | 3334 Lee Rd., Gainesville, FL 37123 | P 21,563,234.00 | 27-4Q | David Wang | 615-227-1245 | 124 River Dr., Franklin, TN 29185 | P 10,314,545.00 | 29-2D | Edgar Escala | 904-338-3416 | 334 Lee Rd., Gainesville, FL 37123 | P 25,559,999.00 | 31-7P | Mary Joy Dumanlang | 904-445-2719 | 216 Motor Rd., Stetson, FL 30155 | P 56,850,000.00 |

1. How many records does the table contain, and how many fields are there per record? A. 35 records and 5 fields thus far there are 1 field per 7 records

2. What problem would you encounter if you wanted to produce a listing by city? How would you solve this problem by altering the table? A. Separate the project and manager by creating a project and manager table where Project has [project_code],[project_price] Manager has [manager_code], [manager_lname], [manager_fname], [manager_phone], [manager_address]

3. If you wanted to produce a listing of the table contents by last name, area code, city, state, or zip code, how would you alter the table? A. 4. What data redundancies do you detect, and how could these redundancies lead to anomalies? 5. Using two relational database tables, PROJECT and MANAGER, eliminate the redundancies discovered in Problem 4. 6. Create the relation database schema to show how the two database tables in Problem 5 are linked.

Part 3

Instructions:

1. Convert the flat database to relational database 2. Draw the E-R diagram 3. Draw the Relation Database Schema (Relational Schema)

Case A Employee Info | Position | Company Loans Applied | 10, Jen, 2 yrs in service | Team Leader | Car, Personal | 20, Len, 5 yrs in service | Project Manager | Car Only | 30, Ken, 1 yr in service | Programmer | Personal Only | 40, Ben, 1 yr in service | Programmer | Personal, Emergency | 50, Sam, 2yrs in service | Web Designer | Car, Emergency | 60, Ace, 1 yr in service | Web Designer | Personal Only |

Case B Rep ID | Representative | Client 1 | Time 1 | Client 2 | Time 2 | Client 3 | Time 3 | TS-89 | Gilroy Gladstone | US Corp. | 14 hrs | Taggarts | 26 hrs | Kilroy Inc. | 9 hrs | RK-56 | Mary Mayhem | Italiana | 67 hrs | Linkers | 2 hrs | | |

Similar Documents

Premium Essay

Cloud Database Management System

.................. 1 Introduction and problems ....................................................................................................... 1 The existing technology ............................................................................................................ 2 Challenges of Implementation: ................................................................................................. 9 Reference: ............................................................................................................................... 10 General business case Thanks to the successful management, the business of the company expands very fast. However, the database management system cannot withstand the quickly and greatly increased work load, the break-down frequency increases, which make the decision-making efficiency and customer experience drop. The company tries to turn around this bad trend and poses two solutions: one is to update the present DBMS including hardware, software and human resource; the other one is to make use of SQL Azure from Microsoft to set up cloud environment and transfer the DBMS there. After cost analysis, we find that to reach the same efficiency standard, the cost of first solution is 9 times of the second solution, and the second solution has merits such as capability, flexibility and elasticity, so we suggest implementing the second solution: Cloud DBMS, SQL Azure. Introduction and problems We are an express company in North...

Words: 3594 - Pages: 15

Premium Essay

Cisp351

...query? 2.3 What does SQL stand for, and what is SQL? 2.4 What does SKU stand for? What is an SKU? 2.5 Summarize how data were altered and filtered in creating the Cape Codd data extraction. 2.6 Explain, in general terms, the relationships among the RETAIL_ORDER, ORDER_ITEM, and SKU_DATA tables. 2.7 Summarize the background of SQL. 2.8 What is SQL-92? How does it relate to SQL statements in this chapter? 2.9 What features have been added to SQL in versions subsequent to the SQL-92? 2.10 Why is SQL described as a data sublanguage? 2.11 What does DML stand for? What are DML statements? 2.12 What does DDL stand for? What are DDL statements? 2.13 What is the SQL SELECT /FROM/WHERE framework? 2.14 Explain how Access uses SQL. 2.15 Explain how enterprise-class DBMS products use SQL. 2.16 There is an intentional flaw in the design of the INVENTORY table used in these exercises. This flaw was purposely included in the INVENTORY tables so that you can answer some of the following questions using only that table. Compare the SKU and INVENTORY tables, and determine what design flaw is included in INVENTORY. Specifically, why did we include it? 2.17 Write an SQL statement to display SKU and SKU_Description. 2.18 Write an SQL statement to display SKU_Description and SKU. 2.19 Write an SQL statement to display Warehouse. 2.20 Write an SQL statement to display Warehouse...

Words: 7421 - Pages: 30

Premium Essay

Database Analysis

...suit their business needs. The company uses Oracle, SQL, and Microsoft Access. The company asked me to develop a helpdesk database using SQL and Microsoft Access. The server-based database that the company uses is the Structured Query Language (SQL) Server to run security. One of the draw backs of the server is that it has many security problems that constantly need to be patched. These patches are important to keep integrity of the data and security and should be scheduled to be applied on regular bases. Microsoft Access is a relational database management system which, allows users to create, edit, and maintain sophisticated databases. When developing the helpdesk database I found the wizard to be easy to use and helpful when creating the tables, data entry screens, display screens, and generating reports. The visual capabilities are user friendly and the user does not need to have programming experience. The wizard is an excellent internal tool to help the user with creating data entry forms and display screens. Microsoft Access also has its security problems. Microsoft Access is restricted to how much data can be stored before needing to be purged which, caused problems with the helpdesk database. When the data reached about two gigabytes, it started to function intermittently and used up many of the workstation's resources. They wanted to keep a history of the problems so that when they in countered the same problem it was easily accessed and displayed on the screen....

Words: 706 - Pages: 3

Premium Essay

Test

...1. (TCO A) A database stores (Points : 5) Ans: E 2. (TCO B) Entities of a given type are grouped into a(n) _____. (Points : 5) entity classes. 3. (TCO C) A determinant that determines all the other columns in a relation is a _____. (Points : 5) D) candidate key 4. (TCO C) A table that meets the definition of a relation is in _____ (Points : 5) A) First Normal Form 5. (TCO D) In a SQL query, which SQL keyword is used with built-in functions to group together rows that have the same value in a specified column? (Points : 5) A) GROUP BY 6. (TCO E) Business intelligence systems fall into which of the following categories? (Points : 5) E) B and C 7. (TCO E) One remedy for the inconsistencies caused by concurrent processing is _____. (Points : 5) d.) resource locking 8. (TCO F) When the correct SQL command is used to delete a table’s structure, what happens to the data in the table? (Points : 5) c.) The data in the table is also deleted. 9. (TCO G) Which of the following is not true about locks? (Points : 5) b.) Locks with small granularity cause more conflicts. 10. (TCO G) The situation that occurs when two users are each waiting for a resource that the other person has locked is known as a(n) (Points : 5) b.) deadlock. 11. (TCO A) Explain why a small database is not necessarily simpler than a large one. (Points : 21) While small databases vary from large databases in terms of the amount of data they store, they can still have the same...

Words: 1262 - Pages: 6

Premium Essay

Distribution Channel

...result in poor performance. For each SQL statement, a database manager application must initiate a separate communication with DB2. To improve application performance, you can create stored procedures that run on your database server. A client application can then simply call the stored procedures to obtain results of the SQL statements that are contained in the procedure. Because the stored procedure runs the SQL statement on the server for you, database performance is improved. In addition, stored procedures can help to centralize business logic. If you make changes to a stored procedure, the changes are immediately available to all client applications that use it. Stored procedures are programs that have the following characteristics: • Contain procedural constructs with SQL statements • Are stored in databases and run on DB2 servers • Can be called by name by an application that is using SQL • Allow an application program to run in two parts: the application on the client and the stored procedure on the server The following figures show how two client applications access a database located on a database server. A client application that does not use stored procedures to access a database can require more network traffic. A client application that takes advantage of a stored procedure can help to reduce network traffic and the number of times the database is accessed. A typical stored procedure contains one or more SQL statements and some manipulative or...

Words: 2097 - Pages: 9

Premium Essay

Paper

...Introduction to Oracle9i: SQL Instructor Guide • Volume 1 40049GC11 Production 1.1 October 2001 D33993 Authors Nancy Greenberg Priya Nathan Copyright © Oracle Corporation, 2000, 2001. All rights reserved. This documentation contains proprietary information of Oracle Corporation. It is provided under a license agreement containing restrictions on use and disclosure and is also protected by copyright law. Reverse engineering of the software is prohibited. If this documentation is delivered to a U.S. Government Agency of the Department of Defense, then it is delivered with Restricted Rights and the following legend is applicable: Restricted Rights Legend Use, duplication or disclosure by the Government is subject to restrictions for commercial computer software and shall be deemed to be Restricted Rights software under Federal law, as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013, Rights in Technical Data and Computer Software (October 1988). This material or any portion of it may not be copied in any form or by any means without the express prior written permission of Oracle Corporation. Any other copying is a violation of copyright law and may result in civil and/or criminal penalties. If this documentation is delivered to a U.S. Government Agency not within the Department of Defense, then it is delivered with “Restricted Rights,” as defined in FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987). The information in this document...

Words: 33172 - Pages: 133

Premium Essay

Saverr Rupee

...Knowledge of Installation, Configuration and maintenance of Oracle 10g and 11g Databases. * Configuring Physical Standby database and its maintenance.Database Upgradation from 10g to 11g. * Analyzing database performance using sql trace and TKPROF. Good in Export and Import for taking logical backup & refresh activities. * Configuration of Flash Recovery Area, Flashback Database and Block Change Tracking for Target Databases. * Creation and maintenance of database links and materialized views. * Index creation and reorganization. * Moderate understanding MSSQL & SYBASE. Mainly User-management, backup & restore activities. * Using AWR, ADDM, ASH report and other Oracle utilities for Proactive Oracle Tuning. * Good in Database Cloning (Cold/Hot ) * Good in User Management and User security. * Database backup and restoration activities. * Good in Business Communication. * Good in Business Writing, Coordination. * Ability to exhibit good team spirit. * Ability to complete assigned work on time. Technical Skills Language | SQL, PL/SQL,Shell Scripting. | Database | Oracle 10g,11g, MSSQL,SYBASE. | Operating System | Linux(RHEL 4,RHEL 5). | Oracle Tools | SQL*PLUS,RMAN,tkprof. | Work Experience Organization: Cambridge Technology India Pvt. Ltd. Duration: Dec 2009 to Till Date . Role: Oracle DBA. Project Details: Client Profile | Societe Generale is a France based...

Words: 532 - Pages: 3

Premium Essay

Ndas Case Study

...should include passengers name, Indetity number, gender, date of birth, date of birth, address and any other information that your team feels might be relevant 2. Flight information . this should include flight number, airline company,departure time, arrival time, departure city, destination, passenger number, airplane number etc. 3. Luggage information. It must include luggage id,weight, owner, flight No. etc 4. Destination: country name, partuclar city of destination, airport of destination 5. Airplane information: Type, name, code Your tasks 1. Indenttify entities to store information about the given problem [10 marks] 2. Design data model for the problem and specufy all reuired parametsr [10 Marks] 3. Derive the data dictionary for the data model used [5 Marks] 4. Convert the Data Model to SQL using MySQL environment (MySQL console). Ensure that you adhere to the concept of...

Words: 981 - Pages: 4

Premium Essay

Database Systems

...Database Systems Adam Fabian DBM / 380 Database Systems Database Systems are emerging as an essential technology in today’s digital society. As human dependence on technology continues to evolve, databases continue to provide the backbone to any customer or data based system and assist organizations in storing vast amounts of information in a reference-able and organized manner. Database systems are specially designed pieces of software that store and organize vast amounts of data in a logical way that users can understand. The size of a database can range anywhere from a few simple records to millions of user accounts with detailed information and data. At my work, databases play an integral part in our company’s success. My current employer, Phoenix Diagnostic Imaging, handles thousands of records related to patient examinations conducted at our facility. The data for each patient is stored in a patient object within the database and referenced using the functionalities provided within the database application. Each one of these objects stores personal information, insurance information, examination data and images, paperwork from each visit, and referring doctor contact information. Employees use this system constantly to access patient records and insert new data into the patient records. Database architecture plays an important role in the success of a database. The three main types of database architecture are the one-tier, two-tier, and...

Words: 792 - Pages: 4

Premium Essay

Assigments

...some people pronounce SQL as “sequel”? Ans: Because of its naming history, SQL is developed from SEQUEL language, so some people pronounce SQL as “sequel”. 2 Why are the manipulation statements of SQL more widely used than the definition and control statements? Ans: Because only the database administrator uses the definition and control statements, while power users and analysts, who are the majority, use the manipulation statements. 3 Is the SQL standard supported in whole or in part? Briefly explain. Ans: The SQL standard is supported in part. Because of the size of the previous standard SQL-92 (contains more than 600 pages) and the current SQL: 1999 standard (contains more than 2,100 pages), there are multiple levels that can be supported. No vendor supports the entire SQL-92 standard now. Most vendors support a super/subset of the standard. With the new SQL: 1999 standard, vendor implementation will likely be more fragmented because of the size and scope of the standard. 4 How many levels of conformance does the SQL-92 standard have? Ans: The SQL-92 specification contained three levels: Entry SQL, Intermediate SQL, and Full SQL. Unfortunately, no vendor claimed conformance beyond Entry SQL although most vendors implemented some features in the higher SQL levels as well as providing proprietary SQL extensions. 5 How many levels of conformance do the SQL: 1999 standard have? Ans: The SQL: 1999 standard contains a single level of conformance called Core SQL. At the time of writing...

Words: 6440 - Pages: 26

Premium Essay

Teach Yourself Sql

...Teach Yourself SQL in 21 Days, Second Edition Table of Contents: Introduction Week 1 at a Glance Day 1 Introduction to SQL Day 2 Introduction to the Query: The SELECT Statement Day 3 Expressions, Conditions, and Operators Day 4 Functions: Molding the Data You Retrieve Day 5 Clauses in SQL Day 6 Joining Tables Day 7 Subqueries: The Embedded SELECT Statement Week 1 in Review Week 2 at a Glance Day 8 Manipulating Data Day 9 Creating and Maintaining Tables Day 10 Creating Views and Indexes Day 11 Controlling Transactions Day 12 Database Security Day 13 Advanced SQL Topics Day 14 Dynamic Uses of SQL Week 2 in Review Week 3 at a Glance Day 15 Streamlining SQL Statements for Improved Performance Day 16 Using Views to Retrieve Useful Information from the Data Dictionary Day 17 Using SQL to Generate SQL Statements Day 18 PL/SQL: An Introduction Day 19 Transact-SQL: An Introduction Day 20 SQL*Plus Day 21 Common SQL Mistakes/Errors and Resolutions Week 3 in Review Appendixes A Glossary of Common SQL Statements B Source Code Listings for the C++ Program Used on Day 14 C Source Code Listings for the Delphi Program Used on Day 14 D Resources E ASCII Table F Answers to Quizzes and Excercises © Copyright, Macmillan Computer Publishing. All rights reserved. Teach Yourself SQL in 21 Days, Second Edition Acknowledgments A special thanks to the following individuals: foremost to my loving wife, Tina, for her tolerance and endless support, to Dan Wilson for his...

Words: 128515 - Pages: 515

Premium Essay

Sql Database

...dwqwdlqkdmqwkldnqwkldnwkdnwqdldkwd Solutions To Workshop Exercises Chapter 1: SQL and Data 4 Chapter 2: SQL: The Basics 13 Chapter 3: The WHERE and ORDER BY Clauses 20 Chapter 4: Character, Number, and Miscellaneous Functions 27 Chapter 5: Date and Conversion Functions 42 Chapter 6: Aggregate Functions, GROUP BY and HAVING 57 Chapter 7: Equijoins 73 Chapter 8: Subqueries 108 Chapter 9: Set Operators 126 Chapter 10: Complex Joins 137 Chapter 11: Insert, Update, and Delete 164 Chapter 12: Create, Alter, and Drop Tables 178 Chapter 13: Indexes, Sequences, and Views 188 Chapter 14: The Data Dictionary, Scripting, and Reporting 197 Chapter 15: Security 213 Chapter 16: Regular Expressions and Hierarchical Queries 222 Chapter 17: Exploring Data Warehousing Features 235 Chapter 18: SQL Optimization 248 Chapter 1: SQL and Data In this chapter, you learned about data, how data is organized in tables, and how the relationships among the tables are depicted in a schema diagram. Based on your newly acquired knowledge, design a schema diagram based on the fictional ACME Construction Company. Draw on your own work experience to design the following components. 1. Draw boxes for these three tables: EMPLOYEE, POSITION, and DEPARTMENT. Solution: See the solution for Exercise 3. 2. Create at least three columns for each of the tables and designate a primary key for each table. Solution: See the solution for Exercise 3. 3. Create relationships among the...

Words: 6586 - Pages: 27

Premium Essay

Db Testing

...Testing at the data access layer is the point at which your application communicates with the database. Tests at this level are vital to improve not only your overall test strategy, but also your product’s quality. In this presentation you’ll find out what you need to know to test the SQL database engine, stored procedures, and data views. Find out how to design effective automated tests that exercise the complete database layer of your applications. You’ll learn about the most common and vexing defects related to SQL databases and the best tools available to support your testing efforts. Copyright Sammamish Software Services 2003. All rights Reserved 1 8/26/2004 The Data Access Layer Testing at the data access layer is the point at which your application communicates with the database. ! In this presentation we’ll discuss why tests at this level are vital to improve not only your overall test strategy, but also your product’s quality ! Copyright Sammamish Software Services 2003. All rights reserved. 2 How to design effective automated tests that exercise the complete database layer of your applications. Donation Street demo The most common and vexing defects related to SQL database The best tools available to support your testing efforts. A strong foundation in Structured Query Language is becoming increasingly necessary and even required by some companies in today’s data environments. Many test professionals are...

Words: 5030 - Pages: 21

Premium Essay

Deep'Z Studio.

...INTRODUCTION SQL is divided into the following  Data Definition Language (DDL)  Data Manipulation Language (DML)  Data Retrieval Language (DRL)  Transaction Control Language (TCL)  Data Control Language (DCL) DDL -- create, alter, drop, truncate, rename DML -- insert, update, delete DRL -- select TCL -- commit, rollback, savepoint DCL -- grant, revoke CREATE TABLE SYNTAX Create table (col1 datatype1, col2 datatype2 …coln datatypen); Ex: SQL> create table student (no number (2), name varchar (10), marks number (3)); INSERT This will be used to insert the records into table. We have two methods to insert.   a) By value method By address method USING VALUE METHOD Syntax: insert into (table_name) values (value1, value2, value3 …. Valuen); © Copy rights are reserved. 2 Ex: SQL> insert into student values (1, ’sudha’, 100); SQL> insert into student values (2, ’saketh’, 200); To insert a new record again you have to type entire insert command, if there are lot of records this will be difficult. This will be avoided by using address method. b) USING ADDRESS METHOD Syntax: insert into (table_name) values (&col1, &col2, &col3 …. &coln); This will prompt you for the values but for every insert you have to use forward slash. Ex: SQL> insert into student values (&no, '&name', &marks); Enter value for no: 1 Enter value for name: Jagan Enter value for marks: 300 old new SQL> 1:...

Words: 42387 - Pages: 170

Premium Essay

Synopsis of Hostel

...amount of data manually is a tricky task. In the existing system, it is very difficult and time intense process to manage stocks and stores information. The planned system will keep the information of stock and daily sail purchase. This system will also keep the record of employ salaries and other expenses of store. It will reduce the chances of errors and repetition of records and make it trouble-free to get the information of any medicine in the stock. The planned system will facilitate the users for swift and rapid access to the required data. It will provide facility to create eliminate and update the sales and purchase records of the medicines. This computerized system will be implemented for automation of management system by using SQL 2008r as back-end for database and .Net as front end. UNIVERSITY OF AGRICULTURE, FAISALABAD Department of Computer Science (Synopsis for M.Sc. Degree in Computer Sciences) Title: COMPUTERISED MANAGEMENT SYSTEM FOR SHAHEEN CHEMIST SATYANA ROAD, FAISALABAD II. Date of admission : 19thNovember, 2009 Data of initiation (Research) : After approval Probable duration (Research) : 4 Months III. Personal...

Words: 2913 - Pages: 12