Question

This is for SQL Database (Oracle) I have three tables MPROPERTY, MEMPLOYEE, and MSERVICE with the...

This is for SQL Database (Oracle)

I have three tables MPROPERTY, MEMPLOYEE, and MSERVICE with the following attributes:

MPROPERTY (Property_ID, Owner_ID, Owner_Name, Owner_email, Owner_type)

Property_ID is the id of property owned by an owner (assume one property can be owned by one owner only)

Owner_ID is the ID of Owner

Owner_name is name of the owner

Owner_email is the e-mail of the owner

Owner_type is type of owner (individual, corporate or Partnership)

MEMPLOYEE (Employee_ID, Last_name, First_Name, CellPhone, ExperienceLevel)

EMPLOYEE_ID is the ID of employee

Last_name is last name of the employee

First_name is the first name of employee

CellPhone is cell number of employee

ExperienceLevel is based on number of years of experience and is classified as Master, Junior or Senior

MSERVICE (Property_ID, Employee_ID, Service_Date, Hours_worked)

Service_date is the date that property was serviced

Hours_worked is the number of hours that employee worked on that project

________________________________________________________________

Answer the following by writing SQL queries:

  1. Give employee_id of employees not servicing any properties
  1. Give the average hours worked by employee whose last name is CORY.
  1. Give the maximum, average and minimum working hours of each employee in the current database
  1. Give name of owners that own more than 2 properties
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Sample Data Inserted For Testing:

Query 1 SQL File 3* 1310 SQL File 4* Sl SQL File 5 SQL File 6* X Limit to 1000 rows - Q 1 8. insert into MPROPERTY values(101

Query1:

select e.Employee_ID from MEMPLOYEE e left join MSERVICE s on e.Employee_ID = s.Employee_ID where s.Employee_ID is null;

output image:

Query 1 SQL File 3* SQL File 4* SQL File 5 SQL File 6 x 12 0 0 S Limit to 1000 rows - Q 1 2 insert into MPROPERTY values(103,

Query 2)

select e.Employee_ID,avg(s.Hours_worked) from MEMPLOYEE e left join MSERVICE s on e.Employee_ID = s.Employee_ID where e.Last_Name='CORY';

output image:

Query 1 SQL File 3* SQL File 4* SQL File 5 SQL File 6 x 2 1 0 0 Limit to 1000 rows Q 1 insert into MPROPERTY values(104,204,

Query 3)

select Employee_ID,max(Hours_worked),min(Hours_worked),avg(Hours_worked) from MSERVICE group by Employee_ID;

Output Image:

Query 1 B 13. 14 • SQL File 3* SQL File 4* SQL File 50 SQL File 6 x 3 0 SC Limit to 1000 rows $ Q 1 insert into MEMPLOYEE val

Query 4)

No Owner is there with me more than 2 properties are assigned to it.

According to the suggestions provided for this case, one owner will have only one property associated with it.

By Self join the table PROPERTY , we will get the properties which are assigned more than two for one owner.

select Owner_ID,count(Propert_ID) from MPROPERTY group by Propert_ID;

output Image:

: Query 1 B SQL File 3* SQL File 4* 100 So 1 SQL File 5 SQL File 6* x Limit to 1000 rows - 2 Q 1 a 25 26. select e. Employee_

Add a comment
Know the answer?
Add Answer to:
This is for SQL Database (Oracle) I have three tables MPROPERTY, MEMPLOYEE, and MSERVICE with the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is for SQL Database (Oracle) I have three tables MPROPERTY, MEMPLOYEE, and MSERVICE with the...

    This is for SQL Database (Oracle) I have three tables MPROPERTY, MEMPLOYEE, and MSERVICE with the following attributes: MPROPERTY (Property_ID, Owner_ID, Owner_Name, Owner_email, Owner_type) Property_ID is the id of property owned by an owner (assume one property can be owned by one owner only) Owner_ID is the ID of Owner Owner_name is name of the owner Owner_email is the e-mail of the owner Owner_type is type of owner (individual, corporate or Partnership) MEMPLOYEE (Employee_ID, Last_name, First_Name, CellPhone, ExperienceLevel) EMPLOYEE_ID is...

  • Please refer to the following business scenarios: (i) Using SELECT statements of SQL, find the employee...

    Please refer to the following business scenarios: (i) Using SELECT statements of SQL, find the employee id, first name, last name, job title and email of all employees working in Asia (i.e. all countries coming from the region     ‘Asia’). This query must be implemented as a nested query! (ii) Using SELECT statements of SQL, find the employee id, first name, last name, job title and supervisor id of employees who had worked for more than 3 years and completed...

  • Use the HR database for all the questions in this lab. For each item in this lab, paste the SQL y...

    Use the HR database for all the questions in this lab. For each item in this lab, paste the SQL you used to complete the task and the number of rows retrieved. Ensure you follow the coding standards listed in the ETSU SQL standards guide found on D2L. Save this document as a PDF and name it your_name_lab7.pdf Display the employees’ first name, last name and phone number of employees with salaries greater than 10,000 dollars. SELECT first_name, last_name, phone_number,...

  • IN THE PREVIOUS CHAPTER WE MADE A DATABASE USING OUR LAST NAME AS ITS NAME. QUESTION...

    IN THE PREVIOUS CHAPTER WE MADE A DATABASE USING OUR LAST NAME AS ITS NAME. QUESTION 1 STATES THIS. PLEASE TYPE WHAT NEEDS TO BE TYPED FOR ALL STEPS. THIS USES CODIO a. 1. Connect to the database you created and named in Module One (for example, Jetson). Type after the prompt mysql> a. use (table you named); i. Example: mysql> use Jetson; 2. Create the Employee table using the SQL statement shown here. Press Return after each line. CREATE...

  • Create the database and tables for the database. Show all SQL statements. Include primary and foreign...

    Create the database and tables for the database. Show all SQL statements. Include primary and foreign keys. Insert data into each table. Show select statements and display the output of each table. Note:Student’s name must be inserted into table as part of the data! Perform the SQL below: Query one table and use WHERE to filter the results. The SELECT clause should have a column list, not an asterisk (*). State the purpose of the query; show the query and...

  • I am using Oracle SQL and am new to it. I have seven tables, one of...

    I am using Oracle SQL and am new to it. I have seven tables, one of them is a subtable of two of the others. I need to do the following queries: 1. List all Patients and what Bed they are assigned to 2. List all patients who had Treatments and what Treatment they received 3. List all patients who had tests and what Test they had 4. List the employees (doctors, nurses, etc.) who assisted each patient. 5. List...

  • I need oracle SQL queries: Find the first name and last name of all staff who...

    I need oracle SQL queries: Find the first name and last name of all staff who are supervised by Wilma Smith and worked a breakfast meeting. Find the number of staff who worked at morning events. Hints: use start_hour. Also, keep in mind that a staff member may have worked more than 1 morning event. We are looking for a count of distinct staff. List the total staff cost of each event. Your query should display the location as well...

  • database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED...

    database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED BELOW CREATE TABLE Department ( DECIMAL(5) VARCHAR(30) CHAR(5) DATE NOT NULL NOT NULL NOT NULL * Department number /*Department name * Department manager number */ /Manager start date DNumber DName Manager MSDate CONSTRAINT Department_PK PRIMARY KEY(DNumber) CONSTRAINT Department_CK UNIQUE(DName) CREATE TABLE DeptLocation DECIMAL(5) VARCHAR(50) NOT NULL NOT NULL DNumber * Department number */ * Department location */ Address CONSTRAINT DeptLocation_PK PRIMARY KEY(DNumber, Address) CONSTRAINT...

  • A state-wide land tax assessment database has two tables: LandParcel that stores a set of land...

    A state-wide land tax assessment database has two tables: LandParcel that stores a set of land parcels, and ZoningTypes that stores a set of zoning codes and zoning types. The LandParcel table has 5 columns: ParcelNumb as text indicating each parcel's unique number defined by the State, Zoning as an integer number indicating the numerical code of a zoning type and each land parcel belongs to one zoning type, Owner First Name and Owner Last Name as text indicating the...

  • May I ask the SQL code as follows? The relational database moviedb has the following database...

    May I ask the SQL code as follows? The relational database moviedb has the following database schema: Movie(title, production year, country, run time, major genre) primary key : {title, production year} Person(id, first name, last name, year born) primary key : {id} Award(award name, institution, country) primary key : {award name} Restriction Category(description, country) primary key : {description, country} Director(id, title, production year) primary key : {title, production year} foreign keys : [title, production year] ⊆ Movie[title, production year] [id]...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT