Question

Preliminary Tasks: Task 1 In this Lab, its assumed that you have already created the Agents table and inserted sample data into it. If you dont have it, or if you are using Oracle Live SQL, you will need to create the table by copying and pasting the content of the file Lab02_Data.txt into an SQL Editor, then execute it. Task 2 Create the Branches table and insert sample data into it by executing the following code from your SQL Editor. CREATE TABLE Branches ( branchNo VARCHAR2(4), address VARCHAR2(50), city VARCHAR2(30), county VARCHAR2(30), state VARCHAR2(2), PRIMARY KEY (branchNo)) INSERT INTO Branches VALUES( BO02,366 Tiger Ln,Los Angeles,Los Angeles,CA); INSERT INTO Branches VALUES(B005,55 Waydell St,Fairfield,Essex,NJ); INSERT INTO Branches VALUES(B007,1362 Alabama Rd,Riverside,Riverside,CA); INSERT INTO Branches VALUES(B010,18 Harrison Rd,New York,New York,NY);

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

The queries are given below


The first four subparts have been answered as per HOMEWORKLIB RULES, please repost others.

1)

SELECT agentNo FROM Agents WHERE branchNo= (SELECT branchNo FROM Branches WHERE address= '18 Harison Rd.')

2)

SELECT agentNo FROM Agents WHERE salary> AVG(salary)

3)

SELECT fName, lName, salary, branchNo, address FROM Agents INNER JOIN Branches ON Branches.branchNo= Agents.branchNo ORDER BY salary

4)

SELECT COUNT(agentNo), SUM(salary) FROM Agents GROUP BY state.

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)

Add a comment
Know the answer?
Add Answer to:
Preliminary Tasks: Task 1 In this Lab, it's assumed that you have already created the Agents...
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
  • The Language Is SQL The language is SQL 13- List full details of agents with first...

    The Language Is SQL The language is SQL 13- List full details of agents with first names having exactly three or four letters sorted by the state attribute. 14- List the first name, the last name, the address, the city, the state, the branch number, and the email of agents working in the branch 8005 and having email addresses from yahoo.com. 15-List the first name, the last name, the address, the city, the state, the branch number, and the email...

  • Overview This lab provides you the opportunity to insert and update data with the use of SQL comm...

    Overview This lab provides you the opportunity to insert and update data with the use of SQL commands. The lab will utilize the FLIX2YOU problem, the current schema. In order to start this lab, you must have successfully completed Lab # 6. In Lab # 6, you executed a script that was provided to you. This script created 7 of the FLIX2YOU tables as documented in the Entity Relationship Diagram in the FLIX2YOU problem document. The second part of lab...

  • DROP TABLE IF EXISTS customers; DROP TABLE IF EXISTS orders; DROP TABLE IF EXISTS order_details; DROP...

    DROP TABLE IF EXISTS customers; DROP TABLE IF EXISTS orders; DROP TABLE IF EXISTS order_details; DROP TABLE IF EXISTS items; DROP TABLE IF EXISTS artists; DROP TABLE IF EXISTS employees; -- create tables CREATE TABLE customers (    customer_id INT ,    customer_first_name VARCHAR(20),    customer_last_name VARCHAR(20) NOT NULL,    customer_address VARCHAR(50) NOT NULL,    customer_city VARCHAR(20) NOT NULL,    customer_state CHAR(2) NOT NULL,    customer_zip CHAR(5) NOT NULL,    customer_phone CHAR(10) NOT NULL,    customer_fax CHAR(10),    CONSTRAINT customers_pk...

  • 2. The Vice President of Marketing for your firm wants the firm’s sales representatives to be...

    2. The Vice President of Marketing for your firm wants the firm’s sales representatives to be able to directly view and edit customer details, but only for the state to which a particular sales representative is assigned. You have suggested that this need can be addressed with a view. For example, a view could be created for one particular state, and user account permissions for accessing that view granted only to sales representatives from that state. The VP has asked...

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