Home / CSE / SQL Basics :: section-1

CSE :: SQL Basics

  1. 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 > ANY (SELECT SALARY FROM EMPLOYEE);
    prints

  2. A.

     10

    B.

     9

    C.

     5

    D.

     0


  3. The SQL statement
    SELECT SUBSTR('abcdefghij', INSTR('123321234', '2', 3, 2), 2) FROM DUAL;
    prints

  4. A.

     gh

    B.

     23

    C.

     bc

    D.

     ab


  5. The SQL statement
    SELECT ROUND(45.926, -1) FROM DUAL;

  6. A.

     is illegal

    B.

     prints garbage

    C.

     prints 045.926

    D.

     prints 50


  7. Which of the following must be enclosed in double quotes?

  8. A.

     Dates

    B.

     Column Alias

    C.

     Strings

    D.

     All of the above


  9. Which of the following command makes the updates performed by the transaction permanent in the database?

  10. A.

     ROLLBACK

    B.

     COMMIT

    C.

     TRUNCATE

    D.

     DELETE


  11. Which command undo all the updates performed by the SQL in the transaction?

  12. A.

     ROLLBACK

    B.

     COMMIT

    C.

     TRUNCATE

    D.

     DELETE


  13. Find all the cities whose humidity is 89

  14. A.

     SELECT city WHERE humidity = 89;

    B.

     SELECT city FROM weather WHERE humidity = 89;

    C.

     SELECT humidity = 89 FROM weather;

    D.

     SELECT city FROM weather;


  15. Find the temperature in increasing order of all cities

  16. A.

     SELECT city FROM weather ORDER BY temperature;

    B.

     SELECT city, temperature FROM weather;

    C.

     SELECT city, temperature FROM weather ORDER BY temperature;

    D.

     SELECT city, temperature FROM weather ORDER BY city;


  17. What is the meaning of LIKE '%0%0%'

  18. A.

     Feature begins with two 0's

    B.

     Feature ends with two 0's

    C.

     Feature has more than two 0's

    D.

     Feature has two 0's in it, at any position


  19. Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy

  20. A.

     SELECT city, temperature, condition FROM weather WHERE condition NOT IN ('sunny', 'cloudy');

    B.

     SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN ('sunny', 'cloudy');

    C.

     SELECT city, temperature, condition FROM weather WHERE condition IN ('sunny', 'cloudy');

    D.

     SELECT city, temperature, condition FROM weather WHERE condition BETWEEN ('sunny', 'cloudy');