Explore topic-wise InterviewSolutions in .

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 is the right syntax for the assertion?(a) Create assertion ‘assertion-name’ check ‘predicate’;(b) Create assertion check ‘predicate’ ‘assertion-name’;(c) Create assertions ‘predicates’;(d) All of the mentionedThe question was asked in an international level competition.My question is from Integrity Constraints in chapter SQL : Queries, Constraints and Triggers of Database Management

Answer»

Right OPTION is (a) Create assertion ‘assertion-name’ CHECK ‘predicate’;

The BEST I can EXPLAIN: NONE.

2.

In order to maintain the consistency during transactions, database provides(a) Commit(b) Atomic(c) Flashback(d) RetainI have been asked this question in a job interview.This is a very interesting question from Transactions in chapter SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct CHOICE is (b) ATOMIC

The best I can explain: By atomic, EITHER all the effects of the TRANSACTION are reflected in the database, or none are (after rollback).

3.

In case of any shut down during transaction before commit which of the following statement is done automatically?(a) View(b) Commit(c) Rollback(d) FlashbackThe question was asked by my college director while I was bunking the class.This is a very interesting question from Transactions in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct CHOICE is (C) Rollback

Explanation: Once a transaction has executed COMMIT work, its effects can no longer be UNDONE by rollback work.

4.

In SQL the cross-tabs are created using(a) Slice(b) Dice(c) Pivot(d) All of the mentionedThe question was posed to me in an online interview.This question is from OLAP topic in division SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct option is (a) Slice

Explanation: PIVOT (SUM(quantity) for color in (’dark’,’pastel’,’WHITE’)).

5.

In authorization graph, if DBA provides authorization to u1 which inturn gives to u2 which of the following is correct?(a) If DBA revokes authorization from u1 then u2 authorization is also revoked(b) If u1 revokes authorization from u2 then u2 authorization is revoked(c) If DBA & u1 revokes authorization from u1 then u2 authorization is also revoked(d) If u2 revokes authorization then u1 authorization is revokedThe question was asked in an online quiz.The above asked question is from Authorizations topic in division SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct answer is (C) If DBA & u1 REVOKES authorization from u1 then u2 authorization is ALSO revoked

Explanation: A user has an authorization if and only if there is a path from the root of the authorization graph down to the node representing the user.

6.

The user defined data type can be created using(a) Create datatype(b) Create data(c) Create definetype(d) Create typeThe question was asked in my homework.I'd like to ask this question from SQL Data Types and Schemas topic in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

Right option is (d) CREATE type

Easiest explanation - The create type clause can be used to DEFINE new types.Syntax : create type DOLLARS as NUMERIC(12,2) FINAL; .

7.

Which of the following is used to store movie and image files?(a) Clob(b) Blob(c) Binary(d) ImageI have been asked this question in unit test.This intriguing question originated from SQL Data Types and Schemas in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct answer is (b) BLOB

Easiest explanation - SQL THEREFORE provides LARGE-object data types for character data (clob) and binary data (blob). The LETTERS “lob” in these data types stand for “Large OBject”.

8.

Data integrity constraints are used to:(a) Control who is allowed access to the data(b) Ensure that duplicate records are not entered into the table(c) Improve the quality of data entered for a specific property (i.e., table column)(d) Prevent users from changing the values stored in the tableThis question was posed to me during an interview for a job.This question is from Integrity Constraints topic in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

Right OPTION is (C) IMPROVE the quality of data entered for a specific property (i.e., table column)

Best explanation: None.

9.

The number of attributes in relation is called as its(a) Cardinality(b) Degree(c) Tuples(d) EntityThe question was asked by my school principal while I was bunking the class.This interesting question is from Set Operations topic in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

The CORRECT ANSWER is (B) Degree

The best I can explain: None.

10.

If we want to retain all duplicates, we must write ________ in place of union.(a) Union all(b) Union some(c) Intersect all(d) Intersect someThe question was posed to me during an internship interview.This interesting question is from Set Operations topic in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

The CORRECT answer is (a) Union all

The explanation is: Union all will combine all the tuples INCLUDING DUPLICATES.

11.

The ______ clause allows us to select only those rows in the result relation of the ____ clause that satisfy a specified predicate.(a) Where, from(b) From, select(c) Select, from(d) From, whereThe question was asked in homework.My question is taken from SQL Queries topic in portion SQL : Queries, Constraints and Triggers of Database Management

Answer» RIGHT answer is (a) Where, from

Explanation: Where SELECTS the rows on a particular CONDITION. From gives the RELATION which involves the OPERATION.
12.

The basic data type char(n) is a _____ length character string and varchar(n) is _____ length character.(a) Fixed, equal(b) Equal, variable(c) Fixed, variable(d) Variable, equalI got this question in exam.I want to ask this question from SQL Basics and SQL Data Definition topic in section SQL : Queries, Constraints and Triggers of Database Management

Answer»

Right option is (c) Fixed, variable

Easy EXPLANATION - Varchar changes its length ACCORDINGLY whereas char has a specific length which has to be filled by either LETTERS or SPACES.

13.

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 SchemaI had been asked this question by my school teacher while I was bunking the class.The doubt is from SQL Basics and SQL Data Definition topic in section SQL : Queries, Constraints and Triggers of Database Management

Answer»

Correct option is (b) DDL(Data Definition Langauge)

The best I can explain: Data Definition LANGUAGE is the language which PERFORMS all the operation in DEFINING STRUCTURE of relation.

14.

Which join refers to join records from the right table that have no matching key in the left table are include in the result set:(a) Left outer join(b) Right outer join(c) Full outer join(d) Half outer joinI have been asked this question in a job interview.The question is from Join Expressions in section SQL : Queries, Constraints and Triggers of Database Management

Answer»

Right option is (B) Right outer join

For explanation: RIGHT OUTER JOIN: RETURN all rows from the right table and the MATCHED rows from the LEFT table.

15.

How many join types in join condition:(a) 2(b) 3(c) 4(d) 5This question was addressed to me in a national level competition.This is a very interesting question from Join Expressions in chapter SQL : Queries, Constraints and Triggers of Database Management

Answer»

Correct answer is (d) 5

Easiest explanation - TYPES are inner JOIN, left OUTER join, right outer join, FULL join, cross join.

16.

The generalization of cross-tab which is represented visually is ____________ which is also called as data cube.(a) Two dimensional cube(b) Multidimensional cube(c) N-dimensional cube(d) CuboidThis question was posed to me during an interview.My question comes from OLAP in section SQL : Queries, Constraints and Triggers of Database Management

Answer»

The CORRECT CHOICE is (a) Two DIMENSIONAL cube

The explanation is: Each cell in the cube is identified for the values for the THREE dimensional attributes.

17.

Data that can be modeled as dimension attributes and measure attributes are called _______ data.(a) Multidimensional(b) Singledimensional(c) Measured(d) DimensionalThe question was posed to me in final exam.My question is from OLAP in chapter SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct ANSWER is (a) Multidimensional

Easy explanation - Given a RELATION used for data analysis, we can IDENTIFY some of its attributes as measure attributes, since they measure some value, and can be AGGREGATED upon.Dimension attribute DEFINE the dimensions on which measure attributes, and summaries of measure attributes, are viewed.

18.

What are the different in triggers?(a) Define, Create(b) Drop, Comment(c) Insert, Update, Delete(d) All of the mentionedThis question was posed to me in exam.This interesting question is from Triggers topic in section SQL : Queries, Constraints and Triggers of Database Management

Answer» CORRECT option is (C) Insert, UPDATE, Delete

Best explanation: TRIGGERS are not possible for CREATE, drop.
19.

Triggers are supported in(a) Delete(b) Update(c) Views(d) All of the mentionedI had been asked this question during an online exam.This interesting question is from Triggers topic in section SQL : Queries, Constraints and Triggers of Database Management

Answer»

Correct answer is (C) Views

To explain: The triggers RUN after an INSERT, update or DELETE on a table. They are not supported for views.

20.

Which of the following creates a virtual relation for storing the query?(a) Function(b) View(c) Procedure(d) None of the mentionedThis question was posed to me during an interview.The doubt is from Views topic in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

Right answer is (b) View

For explanation: Any such relation that is not PART of the LOGICAL model, but is made VISIBLE to a user as a virtual relation, is called a view.

21.

The predicate in a where clause can involve Boolean operations such as and. The result of true and unknown is_______ false and unknown is _____ while unknown and unknown is _____(a) Unknown, unknown, false(b) True, false, unknown(c) True, unknown, unknown(d) Unknown, false, unknownI have been asked this question in an online quiz.This intriguing question comes from Null Values Operations topic in section SQL : Queries, Constraints and Triggers of Database Management

Answer» CORRECT choice is (d) Unknown, FALSE, unknown

The best explanation: NONE.
22.

If there are n tuples in the partition and the rank of the tuple is r, then its ________ is defined as (r −1)/(n−1).(a) Ntil()(b) Cum_rank(c) Percent_rank(d) rank()This question was addressed to me in my homework.I want to ask this question from Recursive Queries and Aggregation Features in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct OPTION is (C) Percent_rank

Explanation: PERCENT rank of a TUPLE GIVES the rank of the tuple as a fraction.

23.

Which of the following function is used to find the column count of the particular resultset?(a) getMetaData()(b) Metadata()(c) getColumn()(d) get Count()This question was addressed to me during an interview.I need to ask this question from Access SQL From a Programming Language in division SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct choice is (a) getMetaData()

Best explanation: The interface ResultSet

has a method, getMetaData(), that returns a ResultSetMetaData OBJECT that contains METADATA about the result set. ResultSetMetaData, in turn, has methods to FIND metadata information, such as the NUMBER of COLUMNS in the result, the name of a specified column, or the type of a specified column.

24.

Which of the following makes the transaction permanent in the database?(a) View(b) Commit(c) Rollback(d) FlashbackThis question was posed to me in class test.This intriguing question originated from Transactions topic in division SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct answer is (b) Commit

The BEST I can explain: Commit work COMMITS the CURRENT TRANSACTION.

25.

_____ clause is an additional filter that is applied to the result.(a) Select(b) Group-by(c) Having(d) Order byThe question was posed to me during an interview.My query is from Set Operations topic in portion SQL : Queries, Constraints and Triggers of Database Management

Answer» RIGHT option is (c) Having

Easy EXPLANATION - Having is used to provide additional AGGREGATE filtration to the QUERY.
26.

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?(a) DML(Data Manipulation Langauge)(b) DDL(Data Definition Langauge)(c) Query(d) Relational SchemaI had been asked this question in an online interview.This interesting question is from SQL Basics and SQL Data Definition in chapter SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct choice is (a) DML(DATA Manipulation Langauge)

For explanation: DML PERFORMS the CHANGE in the values of the relation.

27.

Which of the following is NOT an Oracle-supported trigger?(a) BEFORE(b) DURING(c) AFTER(d) INSTEAD OFI got this question in a job interview.I would like to ask this question from Triggers topic in section SQL : Queries, Constraints and Triggers of Database Management

Answer» CORRECT answer is (b) DURING

Best EXPLANATION: Example: During TRIGGER is not POSSIBLE in any database.
28.

In contemporary databases, the top level of the hierarchy consists of ______ each of which can contain _____(a) Catalogs, schemas(b) Schemas, catalogs(c) Environment, schemas(d) Schemas, EnvironmentThis question was addressed to me in a job interview.Enquiry is from SQL Data Types and Schemas topic in division SQL : Queries, Constraints and Triggers of Database Management

Answer» CORRECT CHOICE is (a) CATALOGS, schemas

Easy EXPLANATION - NONE.
29.

Which of the following closely resembles Create view?(a) Create table . . .like(b) Create table . . . as(c) With data(d) Create view asThe question was posed to me in an interview for job.This is a very interesting question from SQL Data Types and Schemas topic in division SQL : Queries, Constraints and Triggers of Database Management

Answer»

The CORRECT CHOICE is (b) Create table . . . as

Easy explanation - The ‘create table . . . as’ statement closely resembles the create view statement and both are DEFINED by using queries. The main difference is that the contents of the table are set when the table is CREATED, whereas the contents of a view always reflect the current query result.

30.

Which of the following is not an aggregate function?(a) Avg(b) Sum(c) With(d) MinThe question was posed to me in an interview for job.This is a very interesting question from Aggregate Functions and Nested Subqueries in section SQL : Queries, Constraints and Triggers of Database Management

Answer»

Right option is (C) With

Explanation: With is used to CREATE temporary RELATION and its not an aggregate FUNCTION.

31.

The process of viewing the cross-tab (Single dimensional) with a fixed value of one attribute is(a) Slicing(b) Dicing(c) Pivoting(d) Both Slicing and DicingThis question was addressed to me in an interview for internship.Query is from OLAP topic in chapter SQL : Queries, Constraints and Triggers of Database Management

Answer»

The CORRECT choice is (a) Slicing

For explanation: The SLICE operation selects one particular dimension from a given CUBE and PROVIDES a new sub-cube. Dice selects TWO or more dimensions from a given cube and provides a new sub-cube.

32.

Which of the following is used as the embedded SQL in COBOL?(a) EXEC SQL ;(b) EXEC SQL END-EXEC(c) EXEC SQL (d) EXEC SQL END EXEC;The question was asked during a job interview.I need to ask this question from Access SQL From a Programming Language in section SQL : Queries, Constraints and Triggers of Database Management

Answer»

The CORRECT choice is (b) EXEC SQL END-EXEC

To explain: EXEC SQL ; is NORMALLY in C.

33.

To include integrity constraint in an existing relation use :(a) Create table(b) Modify table(c) Alter table(d) Drop tableI got this question in an online quiz.Question is from Integrity Constraints in chapter SQL : Queries, Constraints and Triggers of Database Management

Answer» CORRECT option is (c) Alter table

Best explanation: SYNTAX – alter table table-name ADD constraint, where constraint can be any constraint on the RELATION.
34.

Materialised views make sure that(a) View definition is kept stable(b) View definition is kept up-to-date(c) View definition is verified for error(d) View is deleted after specified timeI had been asked this question in semester exam.The query is from Views topic in chapter SQL : Queries, Constraints and Triggers of Database Management

Answer»

The CORRECT ANSWER is (b) View definition is KEPT up-to-date

The EXPLANATION is: None.

35.

How many tables may be included with a join?(a) One(b) Two(c) Three(d) All of the mentionedThis question was posed to me by my college director while I was bunking the class.This intriguing question originated from Join Expressions topic in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

Correct option is (d) All of the mentioned

Best explanation: JOIN can combine MULTIPLE TABLES.

36.

The primary key must be(a) Unique(b) Not null(c) Both Unique and Not null(d) Either Unique or Not nullThis question was addressed to me in class test.The question is from Null Values Operations topic in chapter SQL : Queries, Constraints and Triggers of Database Management

Answer» CORRECT option is (C) Both Unique and Not NULL

Explanation: Primary key must SATISFY unique and not null condition for sure.
37.

The variables in the triggers are declared using(a) –(b) @(c) /(d) /@The question was posed to me in examination.The above asked question is from Triggers in section SQL : Queries, Constraints and Triggers of Database Management

Answer» RIGHT OPTION is (b) @

The BEST explanation: Example : DECLARE @EMPID int; where empid is the variable.
38.

Which of the following invokes functions in sql?(a) Prepared Statements(b) Connection statement(c) Callable statements(d) All of the mentionedI had been asked this question in an online interview.Origin of the question is Access SQL From a Programming Language topic in division SQL : Queries, Constraints and Triggers of Database Management

Answer» CORRECT option is (c) Callable statements

Easy EXPLANATION - JDBC provides a Callable Statement interface that allows INVOCATION of SQL stored procedures and functions.
39.

If we wish to grant a privilege and to allow the recipient to pass the privilege on to other users, we append the __________ clause to the appropriate grant command.(a) With grant(b) Grant user(c) Grant pass privelege(d) With grant optionThe question was posed to me in an online interview.Asked question is from Authorizations topic in section SQL : Queries, Constraints and Triggers of Database Management

Answer»

The CORRECT ANSWER is (d) With GRANT option

Best EXPLANATION: NONE.

40.

Which of the following is the syntax for views where v is view name?(a) Create view v as “query name”;(b) Create “query expression” as view;(c) Create view v as “query expression”;(d) Create view “query expression”;This question was posed to me during an interview for a job.I would like to ask this question from Views topic in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

Correct choice is (C) CREATE view v as “QUERY EXPRESSION”;

To explain: is any legal query expression. The view NAME is represented by v.

41.

Ranking of queries is done by which of the following?(a) Group by(b) Order by(c) Having(d) Both Group by and Order byI have been asked this question during an internship interview.Query is from Recursive Queries and Aggregation Features topic in section SQL : Queries, Constraints and Triggers of Database Management

Answer» CORRECT choice is (b) Order by

The BEST I can explain: Order by clause arranges the values in ascending or DESCENDING order where a DEFAULT is ascending order.
42.

A ________ on an attribute of a relation is a data structure that allows the database system to find those tuples in the relation that have a specified value for that attribute efficiently, without scanning through all the tuples of the relation.(a) Index(b) Reference(c) Assertion(d) TimestampI got this question by my school principal while I was bunking the class.This question is from SQL Data Types and Schemas in chapter SQL : Queries, Constraints and Triggers of Database Management

Answer» CORRECT option is (a) INDEX

Easy explanation - Index is the REFERENCE to the TUPLES in a relation.
43.

Which of the following creates a temporary relation for the query on which it is defined?(a) With(b) From(c) Where(d) SelectThe question was asked in exam.My question is from Aggregate Functions and Nested Subqueries topic in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

The CORRECT option is (a) With

Easy explanation - The with CLAUSE PROVIDES a way of DEFINING a temporary RELATION whose definition is available only to the query in which the with clause occurs.

44.

Which of these query will display the the table given above ?(a) Select employee from name(b) Select name(c) Select name from employee(d) Select employeeThis question was posed to me in an internship interview.My enquiry is from SQL Queries topic in chapter SQL : Queries, Constraints and Triggers of Database Management

Answer»

Right ANSWER is (c) SELECT NAME from employee

Easiest EXPLANATION - The field to be displayed is included in select and the table is included in the from clause.

45.

In rank() function if one value is shared by two tuples then(a) The rank order continues as counting numbers(b) The rank order continues by leaving one rank in the middle(c) The user specifies the order(d) The order does not changeThis question was addressed to me in an online interview.Question is from Recursive Queries and Aggregation Features in division SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct OPTION is (b) The RANK order continues by LEAVING one rank in the middle

Easiest explanation - Example. rank() over (order by (GPA) desc).

46.

Any recursive view must be defined as the union of two subqueries: a _______ query that is nonrecursive and a __________ query.(a) Base, recursive(b) Recursive, Base(c) Base, Redundant(d) View, BaseThe question was posed to me during an online interview.This intriguing question comes from Recursive Queries and Aggregation Features in section SQL : Queries, Constraints and Triggers of Database Management

Answer»

Right choice is (a) Base, recursive

Explanation: First compute the base QUERY and add all the resultant TUPLES to the RECURSIVELY DEFINED view relation.

47.

Dates must be specified in the format(a) mm/dd/yy(b) yyyy/mm/dd(c) dd/mm/yy(d) yy/dd/mmThis question was addressed to me during an online exam.The doubt is from SQL Data Types and Schemas in division SQL : Queries, Constraints and Triggers of Database Management

Answer»

The CORRECT CHOICE is (B) yyyy/mm/dd

The best explanation: yyyy/mm/dd is the DEFAULT format in sql.

48.

Domain constraints, functional dependency and referential integrity are special forms of _________(a) Foreign key(b) Primary key(c) Assertion(d) Referential constraintI got this question in exam.The origin of the question is Integrity Constraints in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

The correct answer is (C) Assertion

Best EXPLANATION: An assertion is a predicate expressing a condition we wish the DATABASE to always satisfy.

49.

In order to undo the work of transaction after last commit which one should be used?(a) View(b) Commit(c) Rollback(d) FlashbackThis question was addressed to me during an interview for a job.This interesting question is from Transactions topic in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

Right answer is (C) Rollback

Explanation: Rollback WORK causes the current transaction to be ROLLED BACK; that is, it undoes all the UPDATES performed by the SQL statements in the transaction.

50.

SQL applies predicates in the _______ clause after groups have been formed, so aggregate functions may be used.(a) Group by(b) With(c) Where(d) HavingI got this question by my college professor while I was bunking the class.This question is from Aggregate Functions and Nested Subqueries in portion SQL : Queries, Constraints and Triggers of Database Management

Answer»

Right choice is (b) With

Easy 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.