Home / CSE / SQL Basics :: section-1

CSE :: SQL Basics

  1. Which of the following query finds the total rating of the sailors who have reserved boat "103"?

  2. A.

     SELECT SUM(s.rating) FROM sailors s, reserves r AND r.bid = 103;

    B.

     SELECT s.rating FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103

    C.

     c) SELECT COUNT(s.rating) FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103

    D.

     SELECT SUM(s.rating) FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103


  3. The SELECT statement SELECT 'Hi' FROM DUAL WHERE NULL = NULL; Outputs

  4. A.

     Hi

    B.

     FLASE

    C.

     TRUE

    D.

     Nothing


  5. Which of the following is illegal?

  6. A.

     SELECT SYSDATE - SYSDATE FROM DUAL;

    B.

     SELECT SYSDATE - (SYSDATE - 2) FROM DUAL;

    C.

     SELECT SYSDATE - (SYSDATE + 2) FROM DUAL;

    D.

     None of these


  7. If a query involves NOT, AND, OR with no parenthesis

  8. A.

     NOT will be evaluated first; AND will be evaluated second; OR will be evaluated last.

    B.

     NOT will be evaluated first; OR will be evaluated second; AND will be evaluated last.

    C.

     AND will be evaluated first; OR will be evaluated second; NOT will be evaluated last.

    D.

     The order of occurrence determines the order of evaluation.


  9. Let the statement
    SELECT column1 FROM myTable;
    return 10 rows. The statement
    SELECT ALL column1 FROM myTable;
    will return

  10. A.

     less than 10 rows

    B.

     more than 10 rows

    C.

     exactly 10 rows

    D.

     None of these


  11. Table employee has 10 records. It has a non-NULL SALARY column which is also UNIQUE.
    The SQL statement
    SELECT COUNT(*) FROM employee WHERE SALARY > ALL (SELECT SALARY FROM EMPLOYEE);
    prints

  12. A.

     10

    B.

     9

    C.

     5

    D.

     0


  13. Which of the following SQL commands can be used to add data to a database table?

  14. A.

     ADD

    B.

     UPDATE

    C.

     APPEND

    D.

     INSERT


  15. Which of the following join is also called as an 'inner-join'?

  16. A.

     Non-Equijoin

    B.

     Self-Join

    C.

     Equijoin

    D.

     None of these


  17. Which of the following is NOT a type of SQL constraint?

  18. A.

     PRIMARY KEY

    B.

     ALTERNATE KEY

    C.

     FOREIGN KEY

    D.

     UNIQUE


  19. What is an SQL virtual table that is constructed from other tables?

  20. A.

     view

    B.

     A relation

    C.

     Just another table

    D.

     Query results