SQL Basic Questions and Answers
SQL MCQs : This section focuses on the "Basics" of the SQL. These Multiple Choice Questions (mcq) should be practiced to improve the SQL skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exam and other competitive examinations.
1. Which one of the following is used to define the structure of the relation ,deleting relations and relating schemas ?
A. DML(Data Manipulation Langauge)
B. DDL(Data Definition Langauge)
C. Query
D. Relational Schema
View Answer
Ans : B
Explanation: Data Definition language is the language which performs all the operation in defining structure of relation.
2. Create table student(name varchar ,id integer) What type of statement is this ?
A. DML
B. DDL
C. DCL
D. TCL
View Answer
Ans : A
Explanation: Data Definition language is the language which performs all the operation in defining structure of relation.
3. The basic data type char(n) is a _____ length character string and varchar(n) is _____ length character.
A. Fixed, equal
B. Fixed, variable
C. Equal, variable
D. Variable, equal
View Answer
Ans : B
Explanation: Fixed, variable Varchar changes its length accordingly whereas char has a specific length which has to be filled by either letters or spaces .
4. To remove a relation from an SQL database, we use the ______ command.
A. Delete
B. Purge
C. Drop table
D. Remove
View Answer
Ans : C
Explanation: Drop table deletes the whole structure of the relation .purge removes the table which cannot be obtained again.
5. Insert into Business values (10211, "Jhon", "Chemist", 66000); What type of statement is this ?
A. Query
B. DML
C. Relational
D. DDL
View Answer
Ans : B
Explanation: The values are manipulated .So it is a DML.
6. Updates that violate __________ are disallowed .
A. Integrity constraints
B. Transaction control
C. Authorization
D. DDL constraints
View Answer
Ans : A
Explanation: Integrity constraint has to be maintained in the entries of the relation
7. Aggregate functions can be used in the select list or the_______clause of a select statement or subquery. They cannot be used in a ______ clause.
A. Having, where
B. Group by, having
C. Group by, where
D. Where, having
View Answer
Ans : A
Explanation: To include aggregate functions having clause must be included after where.
8. Which of the following creates temporary relation for the query on which it is defined
A. With
B. From
C. Where
D. Select
View Answer
Ans : A
Explanation: The with clause provides away of defining a temporary relation whose definition is available only to the query in which the with clause occurs..
9. Subqueries cannot:
A. Appear in select, update, delete, insert statements.
B. Retrieve data from a table different from the one in the outer query
C. Join tables
D. Use group by or group functions
View Answer
Ans : C
Explanation: No Explanation.
10. Which of the following is not a aggregate function ?
A. With
B. Avg
C. Sum
D. Min
View Answer
Ans : A
Explanation: With is used to create temporary relation and its not a aggregate function.
11. How can you find rows that do not match some specified condition?
A. EXISTS
B. Double use of NOT EXISTS
C. NOT EXISTS
D. None of the mentioned is correct.
View Answer
Ans : B
Explanation: Double use of NOT EXISTS
12. A Database Management System is
A. Collection of interrelated data
B. Collection of programs to access data
C. Collection of programs
D. None of the mentioned is correct.
View Answer
Ans : B
Explanation: Database Management System is Collection of programs to access data
13. DBMS is an interface between
A. Database and User
B. Database application and database
C. Database and SQL
D. Data and Database
View Answer
Ans : B
Explanation: DBMS is an interface between Database application and database
14. Which of the following is not disadvantages of file system to store data?
A. Data redundancy and inconsistency
B. Difficulty in accessing data
C. Data isolation is not present
D. High Cost
View Answer
Ans : D
Explanation: High cost the following is not disadvantages of file system to store data.
15. Which of the following is an advantage of database management approach?
A. Data is dependent on programs
B. Data redundancy increases
C. Data can be accessed by multiple programs
D. Multiple users cannot access data concurrently
View Answer
Ans : C
Explanation: Data can be accessed by multiple programs following is an advantage of database management approach
16. Which of the following is not a features provided by DBMS?
A. Maintain accuracy of data
B. Utilities for performance analysis and logging
C. Ensure modifications are successful or not done at all
D. Recovery mechanism for data
View Answer
Ans : B
Explanation: Utilities for performance analysis and logging features not provided by DBMS
17. The attribute value that is currently unknown is
A. 0
B. -1
C. NULL
D. "
View Answer
Ans : C
Explanation: The attribute value that is currently unknown is NULL
18. A relational database consists of a collection of
A. Table
B. Record
C. Fields
D. Attributes
View Answer
Ans : A
Explanation: A relational database consists of a collection of Tables.
19. A relationship among a set of values in a table is represented by a
A. Relation
B. Column
C. Row
D. Attributes
View Answer
Ans : C
Explanation: A relationship among a set of values in a table is represented by a Row.
20. The set of permitted values of an attribute is called
A. Tuple
B. Domain
C. Column
D. Table
View Answer
Ans : C
Explanation: The set of permitted values of an attribute is called Column.
Also check :
Discussion