Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a SQL query that returns the employee number, employee name, job, department number and location from the emp and dept tables. Copy and

1. Write a SQL query that returns the employee number, employee name, job, department number and location from the emp and dept tables.

Copy and paste your SQL code into this assignment.

2. Copy and modify the previous SQL query to use a right join to join the emp table to the dept table. What values appear in the result set now?

Copy and paste your SQL code along with your answer to the above question into this assignment.

3. Copy and paste the following SQL code into you ApEx SQL Command window:

insert into emp values(7935, 'EVE', 'MANAGER', 7839, SYSDATE, 2850, NULL, 40);

and click Run

Re-run the SQL query created in part number 2 without making any changes to the query. How does the additional data in the table affect the result set of the query now?

Write your answer to the above question into this assignment.

4. Go to the SQL Scripts window in ApEx, which is under the SQL Workshop menu, and create a SQL file called ps8a. Paste this SQL code into the code window and run it:

CREATE TABLE phone AS(select empno, deptno from emp);

ALTER table phone ADD(phoneNum NUMBER);

UPDATE phone set phoneNum = '8784444' where deptno = 10;

UPDATE phone set phoneNum = '8784445' where deptno = 20;

UPDATE phone set phoneNum = '8784446' where deptno = 30;

UPDATE phone set phoneNum = '8784447' where deptno = 40;

5. Create a SQL query in the SQL command window that will return the empno, enam, deptno and phone number from the emp and phone tables. You will have to join the two tables by first comparing them and decide which columns are in both tables. The phone table was created and populated with the commands above.

Copy and paste your SQL code along with your answer to the above question into this assignment.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions