Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the following relational schema: Sailors (S_ID, S_name, S_rating, S_Age) Boats (B_ID, B_name, B_color) Reservations (S_ID, B_ID, R_date) .Login in to the Linux Oracle server
Using the following relational schema:
Sailors (S_ID, S_name, S_rating, S_Age) Boats (B_ID, B_name, B_color) Reservations (S_ID, B_ID, R_date)
.Login in to the Linux Oracle server and access the database using sqlplus (refer to Oracle Linux Server Instructions) .Display the SQL commands using: SET ECHO ON Create your homework submission log file using: SPOOL 4-FirstLastName-Lab.txt To turn off explain plan for queries: SET AUTOTRACE OFF (if you want to observe Using the sailors schema that you have already created answer the questions that follow: To terminate log file use: SPOOL OFF command what the resulting tuple set is). Part A: Query Optimization To see execution plans for queries use: SET AUTOTRACE TRACEONLY EXPLAIN 1. Run the following two queries: Query 1 select s.sname, b.bname from sailors s, reserves r, boats b Query 2 select s.sname, b.bname from sailors s, reserves r, boats b where s.sid - r.sid and r.bid - b.bid and b.color -red' (10 points) Looking at the explain plan for each query, describe what you see which query is better, and why? Run the following two queries: Query 1: select s.sname from sailors s, reserves r, reserves 2 where s.sid rl.sid and s.sid-r2.sid and rl.bid r2.bid; Query 2: select distinct s.sname from sailors s, reserves ri, reserves r2 where s.sidrl.sid and s.sid r2.sid and rl.bid r2.bid; (10 points) Looking at the explain plan for each query, describe what you see, which query is better and why
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started