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)....
Using SQL Developer Question 1 Create a block to retrieve and display pledge and payment information...
Using SQL Developer Question 1 Create a block to retrieve and display pledge and payment information for a specific donor. For each pledge payment from the donor, display the pledge ID, pledge amount, number of monthly payments, payment date, and payment amount. The list should be sorted by pledge ID and then by payment date. For the first payment made for each pledge, display “first payment” on that output row. Question 2 Redo question 1, but use a different cursor...
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...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table as...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table as if it were being added to MySQL (please give explanations for each line of SQL code and a copy of the code as it would be entered into the query by itself: 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.
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.
Hello! I need to add a method that will display the total number of times the...
Hello! I need to add a method that will display the total number of times the user answered the question correctly, how many time he was right or wrong and the percentage of time they were correct in answering. import java.util.Random; import java.util.Scanner; public class Test { private static int getUserInput() { int n; Scanner scanner = new Scanner(System.in); n = scanner.nextInt(); return n; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String choice = "Yes";...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT