Sort Quiz Over SQL And T-SQL

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Nbans
N
Nbans
Community Contributor
Quizzes Created: 4 | Total Attempts: 7,077
Questions: 10 | Attempts: 285

SettingsSettingsSettings
T SQL Quizzes & Trivia

SQL is a language used in programming for managing data held in a relational database management system. T-SQL, on the other hand, is Microsoft's and Sybase's version. How well do you understand these two? Find out below.


Questions and Answers
  • 1. 

    You can fetch only one row at a time.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The fetch command moves the current cursor position one or more rows down the cursor result set. By default, a fetch returns only a single row.
    The syntax for multiple rows: set cursor rows number for cursor_name

    Rate this question:

  • 2. 

    A stored procedure or trigger can define two cursors with the same name if only one is executed.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    For example, the following stored procedure works, because only one emp_crsr cursor is defined in its scope:
    create procedure sp_emp_proc @id int
    as
    if @id > 100
    declare emp_crsr cursor
    for select fname from employee
    else
    declare emp_crsr cursor
    for select lname from employee
    return

    Rate this question:

  • 3. 

    If @@sqlstatus = 1, then:

    • A.

      Indicates successful completion of the fetch statement.

    • B.

      Indicates that the fetch statement resulted in an error.

    • C.

      Indicates that there is no more data in the result set.

    • D.

      None of these

    Correct Answer
    B. Indicates that the fetch statement resulted in an error.
    Explanation
    If @@sqlstatus = 1, it indicates that the fetch statement resulted in an error. This means that there was an issue with retrieving data from the result set.

    Rate this question:

  • 4. 

    If @@sqlstatus = 2, then:

    • A.

      Indicates successful completion of the fetch statement.

    • B.

      Indicates that the fetch statement resulted in an error.

    • C.

      Indicates that there is no more data in the result set.

    • D.

      None of these

    Correct Answer
    C. Indicates that there is no more data in the result set.
    Explanation
    If @@sqlstatus = 2, it indicates that there is no more data in the result set. This means that the fetch statement has successfully retrieved all the available data and there are no more rows to fetch.

    Rate this question:

  • 5. 

    If @@sqlstatus = 0, then:

    • A.

      Indicates successful completion of the fetch statement.

    • B.

      Indicates that the fetch statement resulted in an error.

    • C.

      Indicates that there is no more data in the result set.

    • D.

      None of these

    Correct Answer
    A. Indicates successful completion of the fetch statement.
    Explanation
    The correct answer is "Indicates successful completion of the fetch statement." This means that if the value of @@sqlstatus is 0, it indicates that the fetch statement was executed successfully and there is no error.

    Rate this question:

  • 6. 

    Which of the following statements is TRUE for the having clause A) aggregates are permitted in the having clause B) subqueries are permitted in the having clause

    • A.

      Only A

    • B.

      Only B

    • C.

      Both A and B

    • D.

      Neither A nor B

    Correct Answer
    C. Both A and B
    Explanation
    The correct answer is Both A and B. The having clause in SQL allows the use of aggregates, such as SUM or COUNT, to filter the results of a query based on a condition. It also permits the use of subqueries, which are queries nested within the main query, to further filter the results. Therefore, both statements A and B are true for the having clause.

    Rate this question:

  • 7. 

    The ________ operator combines result sets from multiple queries.

    • A.

      Union

    • B.

      Inner join

    • C.

      Outer join

    • D.

      Union all

    Correct Answer
    D. Union all
    Explanation
    The "union all" operator combines the result sets from multiple queries, including duplicate rows. It concatenates the rows from all the queries and returns a single result set. This allows for the combination of data from different queries into a single result, without removing any duplicate rows.

    Rate this question:

  • 8. 

    Is it possible to Enable or Disable a Database trigger ?

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    It is possible to enable or disable a database trigger. A trigger is a stored procedure that automatically executes when a specific event occurs in the database. By enabling or disabling a trigger, we can control whether it will execute or not when the associated event occurs. This allows us to temporarily disable a trigger without deleting it from the database, and later enable it again when needed.

    Rate this question:

  • 9. 

    You can create a trigger on a temporary object.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Triggers cannot be created on temporary objects. Temporary objects are session-specific and are automatically dropped at the end of the session. Triggers are used to perform actions when certain events occur on a database table, and they require a permanent object to be associated with. Therefore, it is not possible to create a trigger on a temporary object.

    Rate this question:

  • 10. 

    You can use the disable trigger feature only if you are the table owner or database administrator.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    The statement is stating that the disable trigger feature can only be used by the table owner or the database administrator. This means that regular users or other roles do not have the authority to use this feature. Therefore, the correct answer is true.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • May 11, 2011
    Quiz Created by
    Nbans

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.