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

I am having a hard time writing these SQL queries. Please specify the following queries in...
I am having a hard time writing these SQL queries. Please specify the following queries in SQL on the database schema shown in the figure below. STUDENT Name StudentNumber Class Major Smith 17 1 CS Brown 8 2 CS Kathy 15 1 EE COURSE CourseName CourseNumber CreditHours Department Intro to Computer Science CSE110 4 CS Data Structures CSE205 4 CS Discrete Mathematics MAT240 3 MATH Databases CSE380 3 CS Analog Circuits EE260 3 EE SECTION SectionIdentifier CourseNumber Semester Year Instructor...
In this assignment, you are required to write the SQL statements to answer the following queries...
In this assignment, you are required to write the SQL statements to answer the following queries using PostgreSQL system. The SQL statements comprising the DDL for Henry Books Database are given to you in two files. For that database, answer the following queries. Create the files Q1 to Q10 in PostgreSQL. Do follow the restrictions stated for individual queries. 1. List the title of each book published by Penguin USA. You are allowed to use only 1 table in any...
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.
Hello I need a small fix in my program. I need to display the youngest student...
Hello I need a small fix in my program. I need to display the youngest student and the average age of all of the students. It is not working Thanks. #include <iostream> #include <iomanip> #include <fstream> #include <vector> #include <algorithm> using namespace std; struct Student { string firstName; char middleName; string lastName; char collegeCode; int locCode; int seqCode; int age; }; struct sort_by_age { inline bool operator() (const Student& s1, const Student& s2) { return (s1.age < s2.age); // sort...
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.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT