Advanced Sql(Computer Science > Database ) Questions and Answers

Question 1. What type of join is needed when you wish to include rows that do not have matching values?
  1.    Equi-join
  2.    Natural join
  3.    Outer join
  4.    All of the above
Explanation:-
Answer: Option C. -> Outer join

Question 2. What type of join is needed when you wish to return rows that do have matching values?
  1.    Equi-join
  2.    Natural join
  3.    Outer join
  4.    All of the above
Explanation:-
Answer: Option D. -> All of the above

Question 3. Which of the following is true concerning a procedure?
  1.    You do not create them with SQL.
  2.    They do not need to have a unique name.
  3.    They include procedural and SQL statements.
  4.    They are the same thing as a function.
Explanation:-
Answer: Option C. -> They include procedural and SQL statements.

Question 4. A CASE SQL statement is which of the following?
  1.    A way to establish an IF-THEN-ELSE in SQL.
  2.    A way to establish a loop in SQL.
  3.    A way to establish a data definition in SQL.
  4.    All of the above.
Explanation:-
Answer: Option A. -> A way to establish an IF-THEN-ELSE in SQL.

Question 5. Which of the following statements is true concerning routines and triggers?
  1.    Both consist of procedural code.
  2.    Both have to be called to operate.
  3.    Both run automatically.
  4.    Both are stored in the database.
Explanation:-
Answer: Option A. -> Both consist of procedural code.

Question 6. Which of the following is one of the basic approaches for joining tables?
  1.    Subqueries
  2.    Union Join
  3.    Natural join
  4.    All of the above
Explanation:-
Answer: Option D. -> All of the above

Question 7. Which of the following is true concerning systems information in an RDBMS?
  1.    RDBMS store database definition information in system-created tables.
  2.    This information can be accessed using SQL.
  3.    This information often cannot be updated by a user.
  4.    All of the above.
Explanation:-
Answer: Option D. -> All of the above.

Question 8. The following SQL is which type of join: SELECT CUSTOMER_T. CUSTOMER_ID, ORDER_T. CUSTOMER_ID, NAME, ORDER_ID FROM CUSTOMER_T,ORDER_T WHERE CUSTOMER_T. CUSTOMER_ID = ORDER_T. CUSTOMER_ID
  1.    Equi-join
  2.    Natural join
  3.    Outer join
  4.    Cartesian join
Explanation:-
Answer: Option A. -> Equi-join

Question 9. Embedded SQL is which of the following?
  1.    Hard-coded SQL statements in a program language such as Java.
  2.    The process of making an application capable of generating specific SQL code on the fly.
  3.    Hard-coded SQL statements in a procedure.
  4.    Hard-coded SQL statements in a trigger.
Explanation:-
Answer: Option A. -> Hard-coded SQL statements in a program language such as Java.

Question 10. A UNION query is which of the following?
  1.    Combines the output from no more than two queries and must include the same number of columns.
  2.    Combines the output from no more than two queries and does not include the same number of columns.
  3.    Combines the output from multiple queries and must include the same number of columns.
  4.    Combines the output from multiple queries and does not include the same number of columns.
Explanation:-
Answer: Option C. -> Combines the output from multiple queries and must include the same number of columns.