Write the sql statements for each

Assignment Help Database Management System
Reference no: EM132861944

Assignment Introduction

In this assignment, the employees sample database (created by Fusheng Wang and Carlo Zaniolo at Siemens Corporate Research), a large base of data spread over six separate tables and consisting of 4 million records in total, will be used with the MySQL RDBMS. The following diagram provides an overview of the structure of the employees.db:

Assignment Instructions
• This exercise is to give you the ability to run SQL queries.
• Download employees.db.bz2 file from:
• Unarchive the file (with 7-Zip or similar) to get to employees.db
o File → Open DB → locate employees.db on your computer → Open

For each of the questions below (Part 1-3), write the SQL query in text (so this can be copied for verification), take a screenshot of your SQL statement AND the corresponding results. For example, the following is an example of how each a query and its results should be presented:

Part 1
For parts 1 to 5 below, you are required to write the SQL statements for each. Write SQL query to display and take a screenshot:

1. List all attributes present in the departments relation.

2. List all employee IDs of all past/current employees, their first and last names.

3. List all job titles held by any past/current employees.

4. List all unique job titles found in the database.

5. List all past/current employees' names ordered alphabetically in ascending order, i.e. first name and last name in alphabetical order.

Part 2 :
Write a query in SQL to display and take a screenshot:

1. List all department titles present in the database.

2. List the total number of all employees (past/current).

3. List female employees (past/current) together with all other relation attributes.

4. List past/current employees hired prior to 1986-01-01 with the surname Simmel

5. How many past/current employees' last name begins with the capital letter B?

Use a column alias total with B to output your results. For the following you are required to use SQL statements and provide a screenshot of your results:

6. Create a new table called emp_training with 3 columns:
• trainer_no: this should be the primary key and is of type integer and needs to implemented as an auto-increment.
• first_name: this data type is varchar(30) and should not be NULL
• last_name: this data type is varchar(30) and should not be NULL
• t_module: this data type is varchar(20)

7. Insert 2 new rows into the emp_training table:
Row 1: fname: Joe
lname: Bloggs
module: Google Docs
Row 2: fname: Fred
lname: Bloggs
module: Google Sheets [4 marks]

8. The organisation no longer wishes to record the employees training within the database. Therefore, delete the newly created emp_training table.

9. Alter the employees table to include an email_address field with a data type of varchar(20).

10. Update the email address of Georgi Facello to [email protected], where emp_no equals to 10001.

Part 3 :

Write a query in SQL to display:

1. The number of all employees that started on 1991-05-01.

2. List all emp_no who have had strictly more than 2 titles and display the total number of the titles they have had.

3. The number of employees that have a current salary (i.e. to_date equals to 9999-01-01) between 90000 and 90040.

4. List all unique employees' last and first names (using GROUP BY method) that have a current salary (i.e. to_date equals to 9999-01-01) greater than 90000, outputting both names in descending order (sort by the last name first and then the first name) and also displaying their current salaries (using the INNER JOIN method).

5. First name, last name, all salary dates and related amounts for the employee with employee number 10012.

6. In relation to the table named salaries in Figure 1 above:
a. What is the degree of this table?
b. What column(s), if any, make(s) up the primary key?
c. What column(s), if any, make(s) up the foreign key?

7. In the given schema, the tables dept_emp, dept_manager, salaries, titles have composite keys. Explain for each relation why this is the case?

Attachment:- DATABASES descriptor.rar

Reference no: EM132861944

Questions Cloud

How are read replicas used within aws : How are read replicas used within AWS? How would they be considered beneficial to an application?
Identify potential risks associated with using the cloud : Identify and explain two ways you use the cloud as a consumer. Identify potential risks associated with using the cloud in such ways.
Wastes in service hindering lean transformation : Identify one of the 8 wastes listed in the article and provide an example from a service industry company that illustrates the waste
Financial statement analysis and valuation : Find the financial statements of your selected company and analyze its financial ratios. Cash Flows, growth pattern, any special project
Write the sql statements for each : Write the SQL statements for each. Write SQL query to display and take a screenshot - all salary dates and related amounts for the employee with employee number
New jersey kills hudson river tunnel project : This case illustrates the challenges in making an early termination decision. Often, particularly in the case of public projects,
How much revenue will appear in the company income statement : How much revenue will appear in the company's income statement in the first year using the percentage-of-completion method
What is the correct entry for Flores on December : What is the correct entry for Flores on December 5, assuming the correct payment was received on that date
Identify the type of non-profit health care organization : Identify the type of non-profit health care organization/facility (Women's care center.) that you will be researching and developing for your project.

Reviews

Write a Review

Database Management System Questions & Answers

  When you consider your plan for data warehousing

Discussion: "data wharehousing". When you consider your plan for data warehousing, what do you think are two of the more key items to think about?

  Dimensions and attributes in a star schema model

Explain the use of facts, dimensions and attributes in a star schema model. Explain the use of facts, dimensions and attributes in a star schema model.

  Examine appropriate information system solutions

Create a written report that will review/ examine appropriate information system solutions relevant for an organization within an industry

  Explain what is the nosql movement

Using the Internet or other sources to find two dominate Cloud DBMS vendors and their latest products. Give the URLs for these DBMSs. Explain what is the NoSQL movement. Find one "DBMS" that is NoSQL. Explain what is Vertia. What are the features of..

  Write a sql statement to run your program

Write a sql statement to run your program with a parameter 'Hall' and its output.

  Compare and contrast at least two types of database

Compare and contrast at least two types of database backup. Then suggest and justify which type of database backup would be more suitable to the organization.

  Phase of database development

Entity Relationship Diagrams are input to the phase of Database Development - The attribute Empdeptno is a foreign key referring to the department number (Deptno. of the table Department.

  What are the pros and cons of building a custom etl tool

Discuss the components of an ETL system. What are the pros and cons of building a custom ETL tool. How would you correct bad data in the warehouse?

  Implement a physical schema for the careers database

Implement a physical schema for the 'Careers" Database. Your career being of prime importance to your job hunting and final selection, you have decided to place all information about your career in a relational database; specifically., Oraclel2C {..

  Which model are you more likely to consider for deployment

Two models are applied to a dataset that has been partitioned. Which model are you more likely to consider for final deployment?

  Describes the data needed for a Car Refurbishing company

ISYS1057 - Database Concepts Assignment, RMIT University, Melbourne, Australia. Describes the data needed for a Car Refurbishing company

  What are four oracle system processes that run for database

What is an Oracle Instance? What are the four Oracle system processes that must always be up and running for the database to be useable.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd