Previous Index Next

Review Questions - DBMS and SQL

1. Which SQL statement is used to insert new data in a database?
a. INSERT NEW
b. INSERT INTO
c. ADD NEW
d. ADD INTO


2. Which of the following constraint enforces a field to always contain a value.
a. UNIQUE
b. DISTINCT
c. CHECK
d. NOT NULL


3. Which of the following is not an aggregate function in SQL?
a. SUM()
b. MAX()
c. MIN()
d. MID()


4. In SQL, name the clause that is used to display the tuples in descending order of an attribute.


5. While creating a table, which constraint applied on a column ensures that the column will not be able to contain NULL values as well as all the rows will have unique values for that column?


6. In SQL, write the query to remove table STUDENT stored in a database.


7. EMPLOYEE table has a column named CITY that stores city in which each employee resides. Write SQL query to display details of all rows except those rows that have CITY as 'DELHI' or 'MUMBAI' or 'CHANDIGARH'.


8. Write SQL command to add a column "COUNTRY" with data type and size as VARCHAR(70) to the existing table named "PLAYER". Is it a DDL or DML or TCL command?


9. If there are 10 rows in 'EMP' table and 5 rows in 'DEPARTMENT' table. How many rows will be displayed by the following query?
SELECT * FROM EMP, DEPARTMENT;


10. Given the table 'PLAYER' with the following columns:

PCODE    POINTS
1        50
2        NULL
3        40

Write the output of the following statements:
SELECT AVG(POINTS) FROM PLAYER;


11. In a table 'EMPLOYEE', a column 'OCCUPATION' contains many duplicate values. Write SQL command to list only different values of column 'OCCUPATION'?


12. In SQL, write the command to add a column "GRADE" in an already created table "STUDENT".


13. Write a SQL command to increase the Salary (Column Name: Salary) by 10% of those employees whose salaries are below 5000 in EMP table.


14. Write a statement in SQL to count the number of records of table STUDENT.


15. Write the following SQL command using IN operator.
SELECT * FROM student WHERE rollno = 2 OR rollno = 3




Previous Index Next