Question

In: Computer Science

Link the following two tables: HumanResources.Employee and Sales.SalesPerson then display Employee PK, job title, Date of...

  1. Link the following two tables: HumanResources.Employee and Sales.SalesPerson then display Employee PK, job title, Date of birth, Gender, Sales quotas, Commission percent and bonus. Use an outer join to display all the employee whether they are in sales or not. Make sure to sort by bonus desc. Explain why some of the field from the Sales.SalesPerson table are null.

Solutions

Expert Solution

1).ANSWER :

GIVENTHAT :

Here we have used left outer join to join the two tables with the help of a common key which is not specified but I am assuming employee_pk and sales_id to be same.
If it is different then you can changed accordingly or you can comment I will change and edit the code for you.

The table in joint using left join which is same as left outer join and required columns are shown and it is sorted by bonus in descending order.

here we have used left outer join because in the question it is ask to display all the employee whether they are in sales or not so here we have to use left outer join.

Some of the fields from sales.salesperson table are null because no matching row in the   sales.salesperson table is found in humanresources.employee table so some fields from the sales.salesperson table are null

The SQL code

SELECT Employee PK,
       job title,
       Date of birth,
       Gender,
       Sales quotas,
       Commission percent,
       bonus,
FROM   HumanResources.Employee h
LEFT  JOIN Sales.SalesPerson s
ON h.employee_PK=s.sales_ID
ORDER BY bonus DESC ;

Related Solutions

SQL 9. Link the following two tables: HumanResources.Employee and Sales.SalesPerson then display Employee PK, job title,...
SQL 9. Link the following two tables: HumanResources.Employee and Sales.SalesPerson then display Employee PK, job title, Date of birth, Gender, Sales quotas, Commission percent and bonus. Use an outer join to display all the employee whether they are in sales or not. Make sure to sort by bonus desc. Explain why some of the field from the Sales.SalesPerson table are null.
Write an assembly program that displays the following two options: 1. Display the current date. 2....
Write an assembly program that displays the following two options: 1. Display the current date. 2. Enter a date for a meeting and display remaining days. If the user selects the first option, the program should display the current date in dd/mm/yyyy format. If the user selects the second option, the program asks the user to enter a date for a meeting within year 2020 (in decimal) in dd/mm format. The program then calculates and displays the number of days...
Consider the following schema: Publisher (name, phone, city), PK: name. Book (ISBN, title, year, published_by, previous_edition,...
Consider the following schema: Publisher (name, phone, city), PK: name. Book (ISBN, title, year, published_by, previous_edition, price), PK: ISBN, FK: published_by refs Publisher, previous_edition refs Book. Author (SSN, first_name, last_name, address, income), PK: SSN. Write (aSSN, bISBN), PK: (aSSN, bISBN), FK: aSSN refs Author, bISBN refs Book. Editor (SSN, first_name, last_name, address, salary, works_for, book_count), PK: SSN, FK: works_for refs Publisher. Edit (eSSN, bISBN), PK: (eSSN, bISBN), FK: eSSN refs Editor, bISBN refs Book. Author_Editor (aeSSN, hours), PK: aeSSN, FK:...
Consider the following schema: Publisher (name, phone, city), PK: name. Book (ISBN, title, year, published_by, previous_edition,...
Consider the following schema: Publisher (name, phone, city), PK: name. Book (ISBN, title, year, published_by, previous_edition, price), PK: ISBN, FK: published_by refs Publisher, previous_edition refs Book. Author (SSN, first_name, last_name, address, income), PK: SSN. Write (aSSN, bISBN), PK: (aSSN, bISBN), FK: aSSN refs Author, bISBN refs Book. Editor (SSN, first_name, last_name, address, salary, works_for, book_count), PK: SSN, FK: works_for refs Publisher. Edit (eSSN, bISBN), PK: (eSSN, bISBN), FK: eSSN refs Editor, bISBN refs Book. Author_Editor (aeSSN, hours), PK: aeSSN, FK:...
Please read the following and submit a minimum 150 word commentary at title link above: In...
Please read the following and submit a minimum 150 word commentary at title link above: In your own words, summarize the general philosophies of any two of the following famous economists: John Maynard Keynes, Milton Friedman, Adam Smith, Karl Marx, John Stuart Mills, Friedrich Hayek.
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department...
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department Phone # 0001 John Smith jsmith Accountant 1300 West st 5775 Accounting 2100 8/1998 407-366-5700 0002 Brian Miller badams Admin Assistant 1552 Palm dr 5367 Human resource 2300 4/1995 407-366-5300 0003 James Miller miller Inventory Manager 2713 Buck rd 5432 Production 2520 8/1998 407-366-5400 0004 John Jackson jackson_sam Sales Person 433 tree dr 5568 Sales 2102 6/1997 407-366-5500 0005 Robert Davis Davis Manager 713...
The following two tables are hypothetical production possibilities tables for two countries/economies, Springland and Summerland, and...
The following two tables are hypothetical production possibilities tables for two countries/economies, Springland and Summerland, and indicate output per year.  Assume that initially there is autarky.   Springland’s Production Possibilities Table (in millions) A B C D Umbrellas (U) 60 40 20 0 Pairs of sandals (S) 0 10 20 30 Summerland’s Production Possibilities Table (in millions) M N O P Umbrellas (U) 30 20 10 0 Pairs of sandals (S) 0 20 40 60 Assume that initially, with autarky, Springland is...
The following two tables are hypothetical production possibilities tables for two countries/economies, Springland and Summerland, and...
The following two tables are hypothetical production possibilities tables for two countries/economies, Springland and Summerland, and indicate output per year.  Assume that initially there is autarky.   Springland’s Production Possibilities Table (in millions) A B C D Umbrellas (U) 60 40 20 0 Pairs of sandals (S) 0 10 20 30 Summerland’s Production Possibilities Table (in millions) M N O P Umbrellas (U) 30 20 10 0 Pairs of sandals (S) 0 20 40 60 Assume that initially, with autarky, Springland is...
How to make a General Journal with the following transactions: date, account title and explanations, debit,credit...
How to make a General Journal with the following transactions: date, account title and explanations, debit,credit Business ABC Solutions went into effect December 1, 2017 as a sole proprietorship. These transactions take place during the month of December: Dec. 1    To start the business, Andy deposits $60,000 into the ABC Solution’s bank account. Dec. 1    ABC Solutions purchased a office building for $250,000, paying $20,000 cash, and assuming a mortgage with a bank for the rest. The Mortgage is for...
The following tables form part of a database (Flights Database) held in a relational DBMS: employee...
The following tables form part of a database (Flights Database) held in a relational DBMS: employee (empNo, empName, empSalary, empPosition) aircraft (aircraftNo, acName, acModel, acFlyingRange) flight (flightNo, aircraftNo, fromAirport, toAirport, flightDistance, departTime, arriveTime) certified (empNo, aircraftNo) Where:  employee contains details of all employees (pilots and non-pilots) and empNo is the primary key;  aircraft contains details of aircraft and C is the primary key.  flight contains details of flights and (flightNo, aircraftNo) form the primary key.  certified...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT