Sql Basics(Engineering > Computer Science And Engineering > Dbms Questions And Answers ) Questions and Answers

Question 1. Which one of the following is used to define the structure of the relation ,deleting relations and relating schemas ?
  1.    DML(Data Manipulation Langauge)
  2.    DDL(Data Definition Langauge)
  3.    Query
  4.    Relational Schema
Explanation:-
Answer: Option B. -> DDL(Data Definition Langauge)


DDL(Data Definition Langauge)Data Definition language is the language which performs all the operation in defining structure of relation.



Question 2. Select * from employee
What type of statement is this?
  1.    DML
  2.    DDL
  3.    View
  4.    Integrity constraint
Explanation:-
Answer: Option A. -> DML


DMLSelect operation just shows the required fields of the relation. So it forms a DML



Question 3. Create table employee (name varchar ,id integer) What type of statement is this ?
  1.    DML
  2.    DDL
  3.    View
  4.    Integrity constraint
Explanation:-
Answer: Option B. -> DDL


DDLData Definition language is the language which performs all the operation in defining structure of relation.



Question 4. Which one of the following provides the ability to query information from the database and to insert tuples into, delete tuples from, and modify tuples in the database ?
  1.    DML(Data Manipulation Langauge)
  2.    DDL(Data Definition Langauge)
  3.    Query
  4.    Relational Schema
Explanation:-
Answer: Option A. -> DML(Data Manipulation Langauge)


DML(Data Manipulation Langauge)DML performs change in the values of the relation .



Question 5. The basic data type char(n) is a _____ length character string and varchar(n) is _____ length character.
  1.    Fixed, equal
  2.    Equal, variable
  3.    Fixed, variable
  4.    Variable, equal
Explanation:-
Answer: Option C. -> Fixed, variable


Fixed, variableVarchar changes its length accordingly whereas char has a specific length which has to be filled by either letters or spaces .



Question 6. An attribute A of datatype varchar(20) has the value "Avi . The attribute B of datatype char(20) has value Reed .Here attribute A has ____ spaces and attribute B has ____ spaces .
  1.    3, 20
  2.    20, 4
  3.    20 , 20
  4.    3, 4
Explanation:-
Answer: Option A. -> 3, 20


3, 20Varchar changes its length accordingly whereas char has a specific length which has to be filled by either letters or spaces.



Question 7. Delete from r; r “ relation
This command performs which of the following action ?
  1.    Remove relation
  2.    Clear relation entries
  3.    Delete fields
  4.    Delete rows
Explanation:-
Answer: Option B. -> Clear relation entries


Clear relation entriesDelete command removes the entries in the table.



Question 8. To remove a relation from an SQL database, we use the ______ command.
  1.    Delete
  2.    Purge
  3.    Remove
  4.    Drop table
Explanation:-
Answer: Option D. -> Drop table


Drop tableDrop table deletes the whole structure of the relation .purge removes the table which cannot be obtained again.



Question 9. Insert into instructor values (10211, 'Smith', 'Biology', 66000);
What type of statement is this ?
  1.    Query
  2.    DML
  3.    Relational
  4.    DDL
Explanation:-
Answer: Option B. -> DML


DMLThe values are manipulated .So it is a DML .



Question 10. Updates that violate __________ are disallowed .
  1.    Integrity constraints
  2.    Transaction control
  3.    Authorization
  4.    DDL constraints
Explanation:-
Answer: Option A. -> Integrity constraints


Integrity constraintsIntegrity constraint has to be maintained in the entries of the relation .