Homechevron_rightEngineeringchevron_rightRPSC Programmerchevron_rightProgrammer DBMSchevron_rightConsider the following two tables and four queries in SQL. ...

Consider the following two tables and four queries in SQL. ...

  • Q.

    Consider the following two tables and four queries in SQL.

    Book (isbn, bname), Stock (isbn, copies)

    Query 1:

    SELECT B.isbn, S.copies
    FROM Book B INNER JOIN Stock S
    ON B.isbn = S.isbn;
    

    Query 2:

    SELECT B.isbn, S.copies
    FROM B B LEFT OUTER JOIN Stock S
    ON B.isbn = S.isbn;

    Query 3:

    SELECT B.isbn, S.copies
    FROM Book B RIGHT OUTER JOIN Stock S
    ON B.isbn = S.isbn;

    Query 4:

    SELECT B.isbn, S.copies
    FROM B B FULL OUTER JOIN Stock S
    ON B.isbn = S.isbn;

    Which one of the queries above is certain to have an output that is a superset of the outputs of the other three queries?

  • filter_dramaExplanation
    Answer is : D

    In SQL the FULL OUTER JOIN combines the results of both left and right outer joins and returns all (matched or unmatched) rows from the tables on both sides of the join clause.

    So, option (D) is correct.

Discussion

    No one started the discussion yet. Break the ice and start the conversation.
    Please Login to be part of the discussion.

Similar Questions

  • 1.

    In RDBMS, which type of Join returns all rows that satisfy the join condition ?

  • filter_dramaExplanation
    Answer is : A

    Concept:

    Join operation is used to combine related tuples from two relations into single tuples. Join operation can be stated in terms of Cartesian product followed by SELECT operation.

    Join condition form: ANDAND……AND

    Explanation:

    There are various variations of join operations such as equi-join, natural join, theta join, inner join, outer join.

    • Natural join is performed by equating all attributes pairs that have the same name in the two relations.
    • Join operation with equality condition is known as equi-join.
    • Join operation which is used to combine data from multiple relations so that related information can be presented in a single table is known as inner join. Inner join is a type of match and merge operations defined as combination of Cartesian product and selection.
    • Outer join can be used when we want to keep all the tuples in the result of join regardless of whether or not they have matching tuples in other relation.
  • 2.

    All ____ from multiple tables matching the join condition are returned by the inner join.

  • filter_dramaExplanation
    Answer is : A

    All rows from multiple tables matching the join condition are returned by the inner join.

  • 3.

    A SELECT statement can be used to perform these three functions:
    - Choose rows from a table.
    - Choose columns from a table.
    - Bring together data that is stored in different tables by creating a link between them.
    Which set of keywords describes these capabilities?

  • filter_dramaExplanation
    Answer is : B

    The  select operation selects tuples that satisfy a given predicate. It is denoted by sigma (σ).

    The projection operator π is one of the unary operators in relational algebra (RA) and is used to project columns from a relation. It can select specific columns from a given relation and hide all the other columns.

     join is a way to combine data from two or more tables based on a common column.  It is denoted by â¨.

  • 4.

    In SQL the statement select * from R, S is equivalent to

  • filter_dramaExplanation
    Answer is : B

    A Cartesian coordinate system is a coordinate system that specifies each point uniquely in a plane by a pair of numerical coordinates.

    A CROSS JOIN or CARTESIAN JOIN returns the Cartesian product of an available set of records from multiple joined tables. Thus, this join would equate to an inner join in which the join-condition always evaluates to either True or wherever the join-condition is not present in the statement.

  • 5.

    Which product is returned in a join query have no join condition:

  • filter_dramaExplanation
    Answer is : B

    A Cartesian coordinate system is a coordinate system that specifies each point uniquely in a plane by a pair of numerical coordinates.

    A CROSS JOIN or CARTESIAN JOIN returns the Cartesian product of an available set of records from multiple joined tables. Thus, this join would equate to an inner join in which the join-condition always evaluates to either True or wherever the join-condition is not present in the statement.

Programmer DBMSTopics

leaderboardLeaderboard
  • Rahul Kumar

    191 Points

  • VIKRAM JEET

    54 Points

  • GEETHIKA CHOWDARY

    53 Points

  • sunita saini

    52 Points

  • Zain

    49 Points