InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following cannot be used to modify the data in a database(a) update(b) insert(c) delete(d) dropThe question was asked in semester exam.This interesting question is from Modification of Database topic in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT OPTION is (d) drop Explanation: The drop KEYWORD is USED to delete the entire relation LEAVING no trace of it in the memory. Thus it cannot be used to edit the data in the relation. |
|
| 2. |
Scalar Subqueries can be used in the SQL update statement when they are used under the ____ clause(a) where(b) with(c) set(d) endThis question was addressed to me in semester exam.The query is from Modification of Database in section Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT answer is (c) set To EXPLAIN I would say: SQL subqueries that can occur wherever a value is permitted provided the subquery gives only one TUPLE with a single ATTRIBUTE are CALLED Scalar subqueries. Scalar Subqueries can be used in the SQL update statement when they are used under the set clause. |
|
| 3. |
State true or false: We cannot write a where clause under an update command(a) True(b) FalseI have been asked this question by my school teacher while I was bunking the class.This interesting question is from Modification of Database in section Introduction to Relational Model and Sql of RDBMS |
|
Answer» The correct ANSWER is (b) False |
|
| 4. |
To change a value in a tuple without changing all the values in the tuple, we use the _____ statement(a) insert(b) insert some(c) update(d) alterI have been asked this question in an interview for job.I'd like to ask this question from Modification of Database in section Introduction to Relational Model and Sql of RDBMS |
|
Answer» Right answer is (c) UPDATE |
|
| 5. |
What is the format of entering date into a database while inserting data into it?(a) YYYY-MM-DD(b) “YYYY-MM-DD”(c) ‘YYYY-MM-DD’(d) “DD-MM-YYYY”This question was posed to me in an international level competition.My question is taken from Modification of Database in portion Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT answer is (c) ‘YYYY-MM-DD’ For EXPLANATION I would say: The correct format for entering DATE into the database while INSERTING DATA is ‘YYYY-MM-DD’. |
|
| 6. |
How many relations can a delete command operate on?(a) 0(b) 1(c) 2(d) Infinitely manyThis question was addressed to me in an internship interview.This interesting question is from Modification of Database in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» The correct CHOICE is (b) 1 |
|
| 7. |
SQL subqueries that can occur wherever a value is permitted provided the subquery gives only one tuple with a single attribute are called _________(a) Exact Subqueries(b) Vector Subqueries(c) Positive Subqueries(d) Scalar SubqueriesThe question was asked in quiz.My enquiry is from Nested Subqueries topic in section Introduction to Relational Model and Sql of RDBMS |
|
Answer» The CORRECT CHOICE is (d) Scalar Subqueries |
|
| 8. |
State true or false: We can use Subqueries inside the from clause(a) True(b) FalseThe question was posed to me in an international level competition.My enquiry is from Nested Subqueries in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» Correct option is (a) True |
|
| 9. |
The _________ construct returns true if the argument in the sub-query is void of duplicates(a) not null(b) not unique(c) unique(d) nullThis question was posed to me during an interview.I'd like to ask this question from Nested Subqueries in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» Right answer is (c) UNIQUE |
|
| 10. |
What is a correlated sub-query?(a) An independent query that uses the correlation name of another independent query.(b) A sub-query that uses the correlation name of an outer query(c) A sub-query that substitutes the names of the outer query(d) A sub-query that does not depend on its outer query’s correlation namesThe question was asked by my college professor while I was bunking the class.This intriguing question originated from Nested Subqueries in portion Introduction to Relational Model and Sql of RDBMS |
|
Answer» Right answer is (b) A sub-query that uses the correlation NAME of an OUTER query |
|
| 11. |
The ______ construct returns true if a given tuple is present in the subquery.(a) not exists(b) present(c) not present(d) existsI have been asked this question in a job interview.The doubt is from Nested Subqueries in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» The correct answer is (d) EXISTS |
|
| 12. |
The ________ comparison checker is used to check “each and every” condition(a) all(b) and(c) every(d) eachI got this question in unit test.I need to ask this question from Nested Subqueries topic in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» The correct answer is (a) all |
|
| 13. |
State true or false : Nested Subqueries cannot be used for comparing two different sets(a) True(b) FalseI got this question in final exam.This question is from Nested Subqueries in portion Introduction to Relational Model and Sql of RDBMS |
|
Answer» Correct CHOICE is (b) False |
|
| 14. |
If a set is a collection of values given by the select clause, The ______ connective tests for set membership(a) within(b) include(c) under(d) inI got this question by my college professor while I was bunking the class.Question is taken from Nested Subqueries topic in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT option is (d) in Best EXPLANATION: The in connective is USED to test for the MEMBERSHIP in a set, where the set is a collection of values GIVEN by the select clause. |
|
| 15. |
What is a subquery?(a) A subquery is a select-from-where expression that is nested within another query(b) A subquery is any query that is nested within another query(c) A subquery is a relation that is externally specified which can be used to handle data in queries(d) A subquery is a condition that excludes all the invalid tuples from the databaseI got this question in an interview for job.This intriguing question comes from Nested Subqueries in portion Introduction to Relational Model and Sql of RDBMS |
|
Answer» Correct ANSWER is (a) A SUBQUERY is a select-from-where EXPRESSION that is nested within another query |
|
| 16. |
What values does the count(*) function ignore?(a) Repetitive values(b) Null values(c) Characters(d) IntegersThe question was asked in semester exam.The doubt is from Aggregate Functions in section Introduction to Relational Model and Sql of RDBMS |
|
Answer» RIGHT choice is (b) Null values The best I can explain: The COUNT(*) aggregation FUNCTION ignores null values while calculating the number of values in a particular ATTRIBUTE. |
|
| 17. |
Which keyword is used to rename the resulting attribute after the application of the aggregation function?(a) rename(b) as(c) replace(d) toThe question was posed to me in an interview for internship.Origin of the question is Aggregate Functions topic in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» Correct choice is (b) as |
|
| 18. |
State true or false: We can rename the resulting attribute after the aggregation function has been applied(a) True(b) FalseI have been asked this question in homework.This is a very interesting question from Aggregate Functions in portion Introduction to Relational Model and Sql of RDBMS |
|
Answer» The correct option is (a) True |
|
| 19. |
State true or false: Any attribute which is present in the having clause without being aggregated must not be present in the group by clause.(a) True(b) FalseThe question was posed to me in examination.I'd like to ask this question from Aggregate Functions topic in portion Introduction to Relational Model and Sql of RDBMS |
|
Answer» Right choice is (b) False |
|
| 20. |
The _____ aggregation operation adds up all the values of the attribute(a) add(b) avg(c) max(d) sumI had been asked this question during an interview.I'm obligated to ask this question of Aggregate Functions in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT answer is (d) sum Easy explanation: The sum AGGREGATION operation adds up all the values of the specified ATTRIBUTE. There does not exist any aggregation such as add. |
|
| 21. |
We apply the aggregate function to a group of sets of tuples using the _______ clause.(a) group by(b) group(c) group set(d) group attributeThis question was addressed to me in a job interview.My question is taken from Aggregate Functions in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» Correct answer is (a) GROUP by |
|
| 22. |
State true or false: SQL does not permit distinct with count(*)(a) True(b) FalseI got this question in an interview for internship.My question is from Aggregate Functions topic in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» The correct choice is (a) True |
|
| 23. |
Which of the following is not a built in aggregate function in SQL?(a) avg(b) max(c) total(d) countThis question was addressed to me in unit test.This is a very interesting question from Aggregate Functions topic in portion Introduction to Relational Model and Sql of RDBMS |
|
Answer» The correct choice is (c) total |
|
| 24. |
Which of the following correctly describes the between predicate in the where clause?(a) It is used to check whether a value is in between two specified values(b) It is used to check whether a value is exactly in the center of the relation alphabetically(c) It is used to check whether a value is in between any two other values in the database(d) None of the mentionedI have been asked this question at a job interview.This key question is from Set Operations topic in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» Correct answer is (a) It is USED to check whether a value is in between TWO specified values |
|
| 25. |
Using the _______ clause retains only one copy of identical tuples(a) distinct(b) is not null(c) no repeat(d) fromI got this question by my school teacher while I was bunking the class.The origin of the question is Set Operations topic in portion Introduction to Relational Model and Sql of RDBMS |
|
Answer» The CORRECT ANSWER is (a) distinct |
|
| 26. |
When does the predicate is null succeed?(a) If the value on which it is applied is finite(b) If the value on which it is applied is invalid(c) If the value on which it is applied is blank(d) If the value on which it is applied is more than the allowed limitI had been asked this question in semester exam.My question is from Set Operations in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» The correct choice is (C) If the VALUE on which it is applied is blank |
|
| 27. |
What is the function of the except operation?(a) It excludes all the results present in both the queries(b) It includes the results of the second query but excludes the results of the first query(c) It includes the results of the first query but excludes the results of the second query(d) It includes all the results of both queries but removes duplicatesI had been asked this question in an interview for internship.I would like to ask this question from Set Operations topic in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» RIGHT answer is (c) It includes the results of the first query but excludes the results of the second query For explanation: The except OPERATION includes the results of the first query but excludes the results of the second query. It automatically eliminates DUPLICATES but if we want to retain duplicates we must USE except all in PLACE of except. |
|
| 28. |
What is the function of the intersect operation?(a) It returns the intersection of the results of the results of any two different queries(b) It returns the intersection of the results of two different queries which have the same set of attributes in the select clause(c) It returns the intersection of the results of two different queries which have the same condition in the where clause(d) None of the mentionedI have been asked this question during an interview for a job.My doubt is from Set Operations topic in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» RIGHT answer is (b) It returns the intersection of the results of two DIFFERENT queries which have the same SET of ATTRIBUTES in the select clause Easy explanation: The INTERSECT operation returns the intersection of the results of the results of two different queries which have the same set of attributes in the select clause. It automatically eliminates duplicates. |
|
| 29. |
What is the function of the union operation?(a) It combines the results of any two different queries(b) It combines the results of two different queries which have the same set of attributes in the select clause(c) It combines the results of two different queries which have the same condition in the where clause(d) It gives the Cartesian product of the results of any 2 queriesThis question was addressed to me in a national level competition.This intriguing question originated from Set Operations topic in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT option is (B) It combines the results of TWO different queries which have the same set of attributes in the select clause Easiest explanation: The union OPERATION combines the results of two different queries which have the same set of attributes in the select clause. It automatically eliminates duplicates. |
|
| 30. |
While operating with strings, what does “_ _ _%” match with?(a) A string of three letters(b) A string of at least three letters(c) A string of three words(d) A string of at least three wordsI have been asked this question in my homework.Asked question is from Basic Operations topic in portion Introduction to Relational Model and Sql of RDBMS |
|
Answer» Correct OPTION is (a) A string of three LETTERS |
|
| 31. |
Which keyword is used to rename a relation in a query?(a) rename(b) as(c) is(d) toThis question was addressed to me in final exam.This key question is from Basic Operations in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» The CORRECT choice is (b) as |
|
| 32. |
What does the natural join operation do?(a) It considers only those pairs of tuples that have the same value on those attributes that appear in the schemas of both relations(b) It considers only those pairs of tuples that have the same value on at least one of the attributes that appear in the schemas of both the relations(c) It considers only those pairs of tuples that do not have the same value on those attributes that appear in the schemas of both relations(d) None of the mentionedThis question was posed to me in an online quiz.This intriguing question originated from Basic Operations topic in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» Right option is (a) It CONSIDERS only those pairs of tuples that have the same value on those attributes that appear in the schemas of both RELATIONS |
|
| 33. |
State true or false: Multiple conditions in the where clause are separated by a “,”(a) True(b) FalseI had been asked this question in an internship interview.This interesting question is from Basic Operations in section Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT OPTION is (b) False To EXPLAIN: Multiple conditions in the where clause are SEPARATED by the “and” keyword. |
|
| 34. |
If we specify multiple relations in the from clause and do not specify any conditions in the where clause, what will the result be?(a) The natural join of both the relations(b) The left outer join of both the relations(c) A syntactical error(d) The Cartesian product of both the relationsThe question was posed to me in examination.Question is taken from Basic Operations in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» Right choice is (d) The Cartesian product of both the relations |
|
| 35. |
The ________ clause is used to list the attributes desired in the result of a query(a) select(b) from(c) where(d) createI had been asked this question in unit test.I would like to ask this question from Basic Operations in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT answer is (a) select Best explanation: The select clause is used to list the ATTRIBUTES desired in the result of a QUERY. |
|
| 36. |
What does the above query do?(a) It gives all the tuples having a distinct dept_name(b) It gives the dept_name attribute values of all tuples without repetition(c) It gives all the dept_name attribute of all the tuples(d) It gives all the tuples having a null value under the dept_name attributeThis question was posed to me in an interview for job.The question is from Basic Operations topic in portion Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT choice is (B) It gives the dept_name attribute values of all tuples without repetition Best EXPLANATION: The distinct keyword is used to explicitly force the elimination of duplicate tuples. THUS, the above query excludes duplicates. |
|
| 37. |
The where clause is a predicate involving attributes of the relation in the ______ clause.(a) select(b) from(c) with(d) none of the mentionedI got this question in a job interview.Enquiry is from Basic Operations in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» The CORRECT option is (b) from |
|
| 38. |
Which of the following logical connectives is not included in SQL?(a) and(b) or(c) nor(d) notThe question was posed to me in an online interview.My enquiry is from Basic Operations in section Introduction to Relational Model and Sql of RDBMS |
|
Answer» RIGHT option is (d) not Best EXPLANATION: “not” is not a logical CONNECTIVE included in the SQL. The and, or and nor are logical CONNECTIVES that are included in SQL. |
|
| 39. |
Which of the following keywords is used beside the select clause to explicitly specify that duplicates are not removed?(a) all(b) not unique(c) notnull(d) includeI got this question in an internship interview.My enquiry is from Basic Operations in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» The correct ANSWER is (a) all |
|
| 40. |
Which of the following syntax of the basic query is correct?(a) select from (b) select from (c) select from (d) select from The question was asked by my school teacher while I was bunking the class.Asked question is from Basic Operations topic in portion Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT choice is (b) select EXPLANATION: The select clause is used to select a specific attribute from a GIVEN RELATION. So, the syntactically correct statement is select |
|
| 41. |
What does the notnull integrity constraint do?(a) It ensures that at least one tuple is present in the relation(b) It ensures that at least one foreign key is present in the relation(c) It ensures that all tuples have a finite value on a specified attribute(d) It ensures that all tuples have finite attributes on all the relationsI have been asked this question in an online interview.I need to ask this question from SQL Data definition topic in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» RIGHT answer is (c) It ensures that all tuples have a finite value on a specified ATTRIBUTE Explanation: The notnull integrity constraint ensures that all the tuples have a finite value on the specified attribute in the RELATION. It AVOIDS the specification of null values. |
|
| 42. |
Choose the correct command to delete an attribute A from a relation R(a) alter table R delete A(b) alter table R drop A(c) alter table drop A from R(d) delete A from RThe question was posed to me by my school principal while I was bunking the class.The question is from SQL Data definition topic in section Introduction to Relational Model and Sql of RDBMS |
|
Answer» Correct option is (B) alter table R DROP A |
|
| 43. |
Which of the following commands do we use to delete all the tuples from a relation (R)?(a) delete table R(b) drop table R(c) delete from R(d) drop from RThe question was asked in an interview for internship.I want to ask this question from SQL Data definition in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» Right option is (C) DELETE from R |
|
| 44. |
Which of the following commands do we use to delete a relation (R) from a database?(a) drop table R(b) drop relation R(c) delete table R(d) delete from RThis question was addressed to me by my college professor while I was bunking the class.The query is from SQL Data definition topic in section Introduction to Relational Model and Sql of RDBMS |
|
Answer» Correct choice is (a) drop table R |
|
| 45. |
What is the syntax to load data into the database? (Consider D as the database and a, b, c as data)(a) enter into D (a, b, c);(b) insert into D values (a, b, c);(c) insert into D (a, b, c);(d) insert (a, b, c) values into D;I had been asked this question in an international level competition.This intriguing question originated from SQL Data definition topic in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT answer is (b) insert into D values (a, b, C); To explain I would say: To LOAD data into a DATABASE we USE the insert into command. The syntax is insert into D values (a, b, c) where a, b, c are the appropriate values |
|
| 46. |
If a1, a2, a3 are attributes in a relation and S is another relation, which of the following is an incorrect specification of an integrity constraint?(a) primary key(a1, a2, a3)(b) primary key(a1)(c) foreign key(a1, a2) references S(d) foreign key(a1, a2)This question was addressed to me during an interview.I want to ask this question from SQL Data definition in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» Right answer is (d) foreign key(a1, a2) |
|
| 47. |
Which of the following data types does the SQL standard not support?(a) char(n)(b) String(n)(c) varchar(n)(d) float(n)The question was posed to me during an interview for a job.Enquiry is from SQL Data definition topic in section Introduction to Relational Model and Sql of RDBMS |
|
Answer» Right option is (b) String(n) |
|
| 48. |
Which of the following information does an SQL DDL not specify?(a) The schema for each relation(b) The integrity constraints(c) The operations on the tuples(d) The security and authorization information for each relationI have been asked this question in homework.I need to ask this question from SQL Data definition in chapter Introduction to Relational Model and Sql of RDBMS |
|
Answer» CORRECT choice is (C) The OPERATIONS on the tuples Explanation: The SQL DDL does not specify the operations that are supposed to be made on the tuples. DDL MEANS Data definition language, hence it does not include the operations made. |
|
| 49. |
State true or false: If a relation consists of a foreign key, then it is called a referenced relation of the foreign key dependency.(a) True(b) FalseThis question was addressed to me in final exam.Question is taken from Introduction to the Relational Model topic in division Introduction to Relational Model and Sql of RDBMS |
|
Answer» The correct option is (B) False |
|
| 50. |
Statement 1: A tuple is a row in a relationStatement 2: Existence of multiple foreign keys in a same relation is possible(a) Both the statements are true(b) Statement 1 is correct but Statement 2 is false(c) Statement 1 is false but Statement 2 is correct(d) Both the statements are falseI have been asked this question during an interview.This question is from Introduction to the Relational Model topic in section Introduction to Relational Model and Sql of RDBMS |
|
Answer» The correct answer is (a) Both the statements are true |
|