Question

In: Computer Science

I need SQL queries for these statements 17. Display the contracts and payment methods associated with...

I need SQL queries for these statements

17. Display the contracts and payment methods associated with each referral Patient Last Name, Physician Last Name, Referral Start Date, Contract Start Date, Payment Method Sort Order: Payment Method - ascending Physician Last Name – ascending Patient Last Name – ascending Referral Start Date – ascending Contract Start Date – ascending

18. Display the number of contracts whose payment method is Insurance Number of contracts (This is a single value)

19. Display the number of contracts whose payment method is Insurance, broken out by Insurance Company Insurance Company Name, number of contracts Sort order: Insurance company name

20. List the Employees who are Nurses Employee First Name, followed by a space, followed by Employee Middle Initial, followed by a space, followed by Employee Last Name (call this whole field “Nurses”)

21. Display the average hourly wage for all employees who are aides. Average hourly wage (single value)

22. Display the average hourly wage for all hourly employees broken out by level. Skill level, average wage Sort order: Skill Level

23. Display the total salary for all salaried employees. Total salaries (single value)

Solutions

Expert Solution

NOTE: Here Table names are not given so I've provided the assumptions before each query

------17----
--Assumption: Table names->Contracts,Payments
SELECT Payment_Method,Patient_Last_Name,Physician_Last_Name,Referral_Start_Date,Contract_Start_Date
FROM Contracts,Payments
ORDER BY Payment_Method ASC,Physician_Last_Name ASC,Patient_Last_Name ASC,Referral_Start_Date ASC,Contract_Start_Date ASC

------18----
--Assumption: Table name is Payments
SELECT COUNT(*)
FROM Payments
WHERE Payment_Method = 'Insurance'

-----19----
--Assumption: Table names are-> Company,Payments
SELECT Company_Name,COUNT(*)
FROM Company,Payments
WHERE Payment_Method = 'Insurance'

-----20------
--Assumption: table name Employee having attribute Employee_type value 'Nurse'
SELECT concat(First_Name,' ',Middle_Initial,' ',Last_Name) as "Nurses"
FROM Employee
WHERE Employee_type = 'Nurse'


------21------------
--Assumption: table name Employee having attribute Employee_type value 'aides' and hourly_wage
SELECT AVG(hourly_wage)
FROM Employee
WHERE Employee_type = 'aides'


------22-------------
--Assumption: table Employee having hourly_wage as attribute and Employee_type attribute with value 'hourly_wage'
SELECT Skill_level,AVG(hourly_wage)
FROM Employee
WHERE Employee_type = 'hourly_wage'
ORDER BY Skill_level


-------23------------
--Assumption: table Employee having Employee_type attribute with value 'salaried' and attribute salary
SELECT SUM(salary)
FROM Employee
WHERE Employee_type = 'salaried'


Related Solutions

Question 1: Part 1 Write SQL statements for the following queries from the ‘EMPLOYEE’ table in...
Question 1: Part 1 Write SQL statements for the following queries from the ‘EMPLOYEE’ table in the WPC Database in MySQL: Display all records from the Employee table for employees working in the “Marketing” department. Display all records from the Employee table for employees working in the “Marketing” department OR “Finance” Department. Display the Last Names of all employees such that each last name appears only once. Display all the attributes for employees whose employee number is less than 10....
Write SQL queries for the following statements based on Employees table whose schema is given below:...
Write SQL queries for the following statements based on Employees table whose schema is given below: (Employee_ID,First_Name,Last_Name,Email,Phone_Number,Hire_Date,Job_ID,Salary, Manager_Id, Department_Id) a. Create the given table along with the following constraints: Phone_Number should not be left undefined, salary should be between 10000 and 20000, employee_id should uniquely identify rows and should not be left undefined. User-defined names should be given to constraints. b.  Display each employee’s last name, hire date and salary review date (which is the date after six months of service)....
Need SQL Tables Final Project should be included ER, NER, Table diagrams and SQL statements. The...
Need SQL Tables Final Project should be included ER, NER, Table diagrams and SQL statements. The final project is about developing an auction Web site. The details are as follows: BA is an online auction Web site. People can buy and sell items in this Web site. Buyers are people who like to buy items, and sellers are people who like to sell items. •Each seller can sell items. •Each item has a bidding start time, an end time, and...
I am working on an assignment using SQL Server Management and I need to print an...
I am working on an assignment using SQL Server Management and I need to print an ERD to a single page as a PDF file. I am not sure how to do this especially because the diagram is rather large... I am using SQL Server Management Studio I have created an Entity relationship diagram for AdventureWorks that includes all product tables. There are many tables.How do I print it to a single page?
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table: Customer...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table: Customer PK Customer ID Text Phone Number int name text address ID int email text FK vendor ID int Vendor is the name of the table the FK comes from.
SQL- Trigger I have two tables (below) I need to write a trigger that would delete...
SQL- Trigger I have two tables (below) I need to write a trigger that would delete everything for a pid from the Appt table if the pid is deleted from the patient table. Create table Appt(                 pid numeric Foreign Key references patient(pid),                 ptname varchar(50) Foreign Key references patient(name),                 dob date Foreign Key references patient(dob),                 dr varchar(20),                 appdate date,                 apptime time, ); and Create table Patient(                 pid numeric primary key,                 name varchar(50),                ...
/* my calculator is messed up. I need to display interest rate + initial investment. I...
/* my calculator is messed up. I need to display interest rate + initial investment. I keep getting huge numbers, Just need to fix my calculator thats all. import java.util.Scanner;//Import java scanner class public class InterestCalculator1 { //create fields / variables private double initialInvestment; private double annualInterestRate; private double numberOfYears; private double investmentReturn; private double finalAmount; Scanner input = new Scanner(System.in);//create new scanner object //constructor public InterestCalculator1(double initialInvestment, double annualInterestRate, double numberOfYears){ super(); this.initialInvestment = initialInvestment; this.annualInterestRate = annualInterestRate; this.numberOfYears...
I need a MIPS Assembly program that "Display the elements of the linked list in reverse...
I need a MIPS Assembly program that "Display the elements of the linked list in reverse order." It needs subprogram and those subprogram does not have t registers.
1) I need a good desrcption/understadning of different methods of evulating private companies. (i need to...
1) I need a good desrcption/understadning of different methods of evulating private companies. (i need to turn this into a 500 word essay so the more detial the better thank you!) 1b) Out of the numerous mathods that exsist, i need to illustarte three through excel (please explain in detial how this would work or how it should be laid out if possible thank you!)
I need to show this using SQL: Credit card numbers should include asterisks in place of...
I need to show this using SQL: Credit card numbers should include asterisks in place of all digits preceding the last four digits, which will be left visible, regardless of credit card length
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT