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

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

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