Question

Consider the following database schema with tables T1 with column t1 and values (x,z,a), T2 with...

Consider the following database schema with tables T1 with column t1 and values (x,z,a), T2 with column t2 and values (b,y) and T3 with column t3 and values (a,b,c). You need to display the matching rows of tables T1 and T2 . The best way is to join T1 and T2; however, there is no common field between these two tables. Write a single SQL query that solves this problem.

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

Here is the solution problem. Since T1 and T2 have no row in common it is better to join T2 with T3 since they have the field b in common and then join the resulting table with T1 so sql query will be

SELECT * FROM T1, (SELECT * FROM T2,T3 WHERE T2.b ==T3.b) as T4

WHERE T1.a == T4.a

Add a comment
Know the answer?
Add Answer to:
Consider the following database schema with tables T1 with column t1 and values (x,z,a), T2 with...
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
  • MYSQL Consider the sql statement "select * from t1 UNION t2" where t1 and t2 are...

    MYSQL Consider the sql statement "select * from t1 UNION t2" where t1 and t2 are two sets (tables). This query executes without any errors. Assume t1 has n columns. How many columns does t2 have? How many columns will the resultset have? Is it possible for the result set to have more records than the combination of t1 and t2 (for example say t1 has 8 records and t2 has 8 records) is it possible for the resultset to...

  • Dr. Ugur Quiz 2 ITC 341 Spring 2019 Name: Consider three tables TI, T2 and T3...

    Dr. Ugur Quiz 2 ITC 341 Spring 2019 Name: Consider three tables TI, T2 and T3 below. Show the results of the following operations: Date: 02.13.2019 Total 20 points, open book & notes) for each question, you need to write down the attribute names on the top, similar to tables below) 10 15 25 z 10 y 30 z 10 25 10 25 z 10 x 6 30 z 3 25 z 6 (Use the space on the right-hand side...

  • Consider a database schema consisting of two tables, Employee (ID, Name, Address), Project(PID, Name, Deadline), Assign...

    Consider a database schema consisting of two tables, Employee (ID, Name, Address), Project(PID, Name, Deadline), Assign (EID, PID, Date). Assign.EID is a foreign key referencing employee's ID and Assign.PID is a foreign key reference the project. Write the SQL query for 1. Find Projects that are not assigned to any employees(PID and Name of the project).

  • Which SQL statement retrieves the EmployeeName and City columns from the Employees table? O LIST EmployeeName,...

    Which SQL statement retrieves the EmployeeName and City columns from the Employees table? O LIST EmployeeName, City ON Employees; O FIND EmployeeName, City ON Employees; SELECT EmployeeName, City FROM Employees; O RETRIEVE EmployeeName, City FROM Employees; Which SQL statement finds the different cities in which national parks reside with no duplicate rows listed? SELECT DISTINCT city FROM natlpark ORDER BY city; O ORDER BY natlpark DISTINCT city; O ORDER BY city FROM natlpark; O SELECT city FROM natlpark ORDER BY...

  • QUESTION 5 Suppose there are two tables: A and B. and we run command SELECT *...

    QUESTION 5 Suppose there are two tables: A and B. and we run command SELECT * from A LEFT JOIN B on A.orderid = B.orderid. What would be the code output? only the records from table A where tables A and B have the same orderid only the records from table B where tables A and B have the same orderid the complete set of records from table A, along with the matching records (depending on the availability) from table...

  • -Advanced Database- Consider the following transaction schedule, where time increases from top to bottom. T1 T2...

    -Advanced Database- Consider the following transaction schedule, where time increases from top to bottom. T1 T2 T3 T4 Read (X) Read(Y) Read(Z) Read(Y) Write(Y) Write(Z) Read(U) Read(Y) Write(Y) Read(Z) Write(Z) Read(U) Write(U) Answer the following questions: Draw the precedence graph of the above schedule. Is this schedule conflict serializable? If yes, show what serial schedule(s) it is equivalent to. If not, explain why. Is this schedule view serializable? If yes, show what serial schedule(s) it is equivalent to. If not,...

  • Consider the following schedule that performs actions taken by transactions T1 and T2 on database objects...

    Consider the following schedule that performs actions taken by transactions T1 and T2 on database objects A and B :                 T1: S(A), R(A), X(B), U(A),  R(B),W(B), Commit: U(B)                 T2: S(B), R(B), X(A), U(B), R(A), W(A), Commit:  U(A)                             Because Strict 2PL is using, this schedule is guaranteed to be conflict serializable. A: True B:False

  • The following tables form part of a database held in a relational DBMS: Hotel (hotelNo, hotelName,...

    The following tables form part of a database held in a relational DBMS: Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Guest (guestNo, guestName, guestAddress) where Hotel contains hotel details and hotelNo is the primary key; Room contains room details for each hotel and (roomNo, hoteINo) forms the primary key; Booking contains details of bookings and (hoteINo, guestNo, dateFrom) forms the primary key; Guest contains guest details and guestNo is the primary key....

  • Consider the following transaction schedule: r1(X), r2(X), r3(X), r1(Y), w2(Z), r3(Y), w3(Z), w1(Y) This schedule is...

    Consider the following transaction schedule: r1(X), r2(X), r3(X), r1(Y), w2(Z), r3(Y), w3(Z), w1(Y) This schedule is conflict-equivalent to some or all serial schedules. Determine which serial schedules it is conflict-equivalent to, and then identify a true statement from the list below. Select one: a. The schedule is conflict-equivalent to (T3, T1, T2) b. The schedule is not serial c. The schedule is conflict-equivalent to (T3, T2, T1) d. The schedule is conflict-equivalent to (T2, T3, T1) e. The schedule is...

  • Using mySQL, tables at the end... This assignment uses the tables from the vets database. The goa...

    Using mySQL, tables at the end... This assignment uses the tables from the vets database. The goal of the assignment is to get you to think about joins- inner join and outer joins.  If you do a join, where you have the names of two or more tables in the From clause, then you must use the condition join syntax or the column name join. Take care that you do not accidentally do a Cartesian product. If your result set...

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