0% found this document useful (0 votes)
86 views

MCQ SQL 1

Uploaded by

xfactor8056
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views

MCQ SQL 1

Uploaded by

xfactor8056
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 124

MCQ SQL

1.
Which of the following are some common RDBMS in use?
Oracle
MySQL
HeidiSQL
All of the above
Hide
Wrong Answer
Explanation: All of the above options are examples of some famous RDBMS in use.
2.
What command is used to create a new table in SQL?
CREATE TABLE
BUILD TABLE
GENERATE TABLE
None of the above
Hide
Wrong Answer
Explanation: The CREATE TABLE command is used to create a new table in SQL.
3.
What does the following statement in SQL do?
DROP TABLE student;
Deletes a table called student.
Creates a table called student.
Check if there is a table called student.
None of the above.
Hide
Wrong Answer
Explanation: The DROP command is used to delete/drop a table in SQL.
4.
Which of the following are types of Unicode character string types in SQL?
nchar
ntext
Both A and B
None of the above
Hide
Wrong Answer
Explanation: nchar and ntext are types of Unicode character strings datatypes in SQL.
5.
What does BLOB in SQL stand for?
Binary Large Objects
Big Large Objects
Binary Language for Objects
None of the above
Hide
Wrong Answer
Explanation: BLOB in SQL stands for Binary Large Objects which is an SQL Object
datatype.
6.
Which of the following datatype is most appropriate for storing a string of up to 255
characters?
TEXT
TINY TEXT
BLOB
BINARY
Hide
Wrong Answer
Explanation: TINY TEXT can contain a string of up to 255 characters or 255 bytes.
7.
What happens when no value is inserted in an ENUM list?
Nothing happens
The code will crash
A blank value is inserted in that case
None of the above
Hide
Wrong Answer
Explanation: In the case an ENUM list is empty and no value is inserted, a blank value
is inserted in the list.
8.
What is the range of integers that can be held in the MEDIUMINT datatype of SQL?
Signed numbers in the range of -8388608 to 8388607.
Unsigned numbers in the range of 0 to 16777215.
Both A and B.
None of the above.
Hide
Wrong Answer
Explanation: Integer with values in the signed range of -8388608 to 8388607 and
values in the unsigned range of 0 to 16777215 can be stored in the MEDIUMINT
datatype.
9.
What does the following code snippet do?
ALTER TABLE STUDENT ADD(ADDRESS VARCHAR2(20));
Adds a column called ADDRESS in the table student.
Checks if a column called ADDRESS is present in the table student.
Invalid Syntax
None of the above
Hide
Wrong Answer
Explanation: The ADD command is used to add a new column with given
specifications into a table by altering the contents of the table.
10.
Which of the following commands is used to delete all rows and free up space from a
table?
TRUNCATE
DROP
DELETE
ALTER
Hide
Wrong Answer
Explanation: TRUNCATE command is used to delete all rows and free up space from a
table.
11.
Which of the following commands are a part of Data Control Language?
Revoke
Grant
Both A and B
None of the above
Hide
Wrong Answer
Explanation: Revoke and Grant are the 2 commands that are a part of Data Control
Language.
12.
What does the following code snippet do?
DELETE FROM STUDENTS
WHERE AGE = 16;
ROLLBACK;
Performs an undo operation on the delete operation.
Deletes the rows from the table where AGE = 16
Deletes the entire table
None of the above
Hide
Wrong Answer
Explanation: The ROLLBACK command is used to perform a rollback onto the latest
unsaved changes.
13.
When is the wildcard in WHERE clause used?
An exact match is necessary for a CREATE statement.
An exact match is not possible in a SELECT statement.
An exact match is necessary for a SELECT statement.
None of the above.
Hide
Wrong Answer
Explanation: Wildcard in WHERE clause is used when an exact match is not possible in
a SELECT statement.
14.
Which of the following is the full form of DDL?
Data definition language
Data derivation language
Dynamic data language
Detailed data language
Hide
Wrong Answer
Explanation: The full form of DDL is Data definition language.
15.
Which SQL constraint do we use to set some value to a field whose value has not been
added explicitly?
UNIQUE
NOT NULL
DEFAULT
CHECK
Hide
Wrong Answer
Explanation: The DEFAULT constraint is used to set a default value for a column which
comes into use when a value for a field in that column is not set.
16.
What are rows of a relation known as?
Degree
Entity
Tuple
None
Hide
Wrong Answer
Explanation: The rows of a relation are known as tuples.
17.
During transaction before commit which of the following statements is done
automatically in case of shutdown?
Rollback
Commit
View
Flashback
Hide
Wrong Answer
Explanation: In case of a shutdown, before committing, Rollback is done.
18.
Which of the following allows you to uniquely identify a tuple?
Schema
Attribute
Super key
Domain
Hide
Wrong Answer
Explanation: Super Key is used to uniquely identify a tuple in a relation.
19.
How many operations are considered to be the most basic SQL operations?
4
3
2
1
Hide
Wrong Answer
Explanation: The 4 basic SQL operations are: Create, Read, Update and Delete(CRUD).
20.
Which of the following is not a SQL command?
DELETE
ORDER BY
SELECT
WHERE
Hide
Wrong Answer
Explanation: DELETE is not a SQL command.
21.
What does the following code snippet do?
SELECT TOP 5 * FROM students;
Select the top 5 entries for all the columns in the students' table.
Select all the entries from the students' table other than the top 5 entries
Selects all entries from the student table except 5 random rows
None of the above
Hide
Wrong Answer
Explanation: The above code snippet basically selects all the top 5 rows from the
students' table.
22.
Which of the following matches the definition given below: It is an artificial key that
aims to uniquely identify each record.
Primary Key
Foreign Key
Surrogate Key
Composite Key
Hide
Wrong Answer
Explanation: Surrogate Key is an artificial key that aims to uniquely identify each
record.
23.
Which of the following commands are used to put a restriction on the number of rows
returned from a query?
LIMIT
LIKE
WHERE
GROUP BY
Hide
Wrong Answer
Explanation: LIMIT is used to put a restriction on how many rows are returned from a
query.
24.
Which of the following are valid logical operators in SQL?
SOME
ALL
AND
All of the above
Hide
Wrong Answer
Explanation: All of the above expressions are valid logical operators in SQL.
25.
Which of the following SQL functions compares the similarities of 2 strings and returns
the result as a 4 character code?
SOUNDEX
DIFFERENCE
CONCAT
None of the above
Hide
Wrong Answer
Explanation: SOUNDEX compares 2 strings and returns their similarity as a 4 character
code.
26.
To select some particular columns, which of the following commands is used?
PROJECTION
SELECTION
JOIN
UNION
Hide
Wrong Answer
Explanation: To select some particular commands, PROJECTION is used.
27.
Primary key can be?
NULL
NOT NULL
Both NULL and NOT NULL
Depends on situation
Hide
Wrong Answer
Explanation: Primary key must always be NOT NULL.
28.
Select the valid SQL type.
NUMERIC
CHARACTER
FLOAT
All of the above
Hide
Wrong Answer
Explanation: All of the above options are valid SQL types.
29.
Which of the following functions do we use to get a specified day of the month for a
given date?
DAY
DATEPART
GETDATE
CURRENT_TIMESTAMP
Hide
Wrong Answer
Explanation: DAY is used to get the specified day of the month for a given date.
30.
Which of the following operators is used to compare a value to a list of literal values
that have been specified?
ANY
BETWEEN
IN
ALL
Hide
Wrong Answer
Explanation: The BETWEEN operator is used to compare a value to a list of literal
values that have been specified.
31.
What is a table joined with itself called?
Join
Self-join
Outer join
None of the above
Hide
Wrong Answer
Explanation: Table joined with itself is called a self join.
32.
NATURAL JOIN can also be termed as -
Combination of Union and cartesian product
Combination of Selection and cartesian product
Combination of Projection and cartesian product
None of the above
Hide
Wrong Answer
Explanation: NATURAL JOIN can also be termed as a combination of Projection and
cartesian product.
33.
Which of the following commands is used to delete a trigger in SQL?
DROP
DELETE
ALTER
None of the above
Hide
Wrong Answer
Explanation: The DROP command is used to delete a trigger in SQL.
34.
How can we view all the triggers currently in the database?
SHOW
VIEW
READ
None of the above
Hide
Wrong Answer
Explanation: The SHOW command will display all the triggers that are currently
present in the table.
35.
Which of the following is known as the minimal super key?
Primary key
Foreign key
Candidate key
None of the above
Hide
Wrong Answer
Explanation: The Candidate Key is also known as the minimal super key.
36.
Select the correct foreign key constraint?
Referential integrity
Entity integrity
Domain integrity
None of the above
Hide
Wrong Answer
Explanation: The most important foreign key constraint is Referential Integrity.
37.
What is NOLOCK in SQL equivalent to?
WRITE UNCOMMITTED
READ COMMITTED
WRITE COMMITTED
READ UNCOMMITTED
Hide
Wrong Answer
Explanation: The NOLOCK in SQL is equivalent to READ UNCOMMITTED.
38.
Which of the following can replace the below query?
SELECT Name, ID
FROM Student, Courses
WHERE Student_ID = Courses_ID;
Select Name,ID from Courses,Student where Student_ID = ID;
Select Name, ID from Student natural join Courses;
Select Name, ID from Student;
Select ID from Student join Courses;
Hide
Wrong Answer
Explanation: The correct replacement of the above query is shown in option B.
39.
What will be the output of the following code snippet?
SELECT ROUND (TRUNCATE (MOD (2500, 20), -1), 2) FROM dual;
Error
00
0
1
Hide
Wrong Answer
Explanation: The MOD(2500, 20) expression will return 0, after which the rest of the
functions will just be applied on the value 0.
40.
How can the user change “Scaler” into “Interviewbit” in the “Name” column in the
Users table?
UPDATE User SET Name = 'Scaler' INTO Name = 'Interviewbit'
MODIFY Users SET Name = 'Interviewbit' WHERE Name = 'Scaler'
MODIFY Users SET Name = 'Scaler' INTO Name = 'Interviewbit'
UPDATE Users SET Name = 'Interviewbit' WHERE Name = 'Scaler'
Hide
Wrong Answer
Explanation: The UPDATE command and WHERE clause are used together to change
the name as asked in the question.
41.
What is the name of the query that is placed within a WHERE or HAVING clause of
another query?
Multi query
Subquery
Super query
Master query
Hide
Wrong Answer
Explanation: It is called subquery.
42.
Which is the AS clause used for?
Rename
Selection
Join
Projection
Hide
Wrong Answer
Explanation: The AS is used for the renaming functionality.
43.
Which of the following are valid SQL constraints?
NOT NULL
CHECK
UNIQUE
All of the above
Hide
Correct Answer
Explanation: All of the above are valid SQL constraints.
44.
Which of the following is also known as a concatenated key?
Primary Key
Foreign Key
Surrogate Key
Composite Key
Hide
Wrong Answer
Explanation: Composite key is also known as a concatenated key since it is composed
of one or more columns.
45.
The program which performs some common action on database data and is also
stored there is called?
Trigger
Stored Procedure
Stored Function
None of the above
Hide
Wrong Answer
Explanation: SQL procedures are stored in SQL codes, which can be saved for reuse
again and again.
46.
How can SQL injections occur?
Data is used to dynamically construct an SQL Query.
Unintended data from an untrusted source enters the application.
Both A and B.
None of the above.
Hide
Wrong Answer
Explanation: SQL injections can occur in the 2 ways described in options A and B.
47.
Which of the following constraints can be defined only at the column level?
UNIQUE
NOT NULL
CHECK
PRIMARY KEY
Hide
Wrong Answer
Explanation: NOT NULL constraint can be defined only at the column level.
48.
Group of operations that form a single logical unit of work called?
Network
Unit
Transaction
None of the above
Hide
Wrong Answer
Explanation: A logical group of statements that is written to perform a single unit of
work is called a transaction.
49.
Identify the concurrency-based protocol?
Lock based protocol
Two-phase locking protocol
Timestamp ordering protocol
All
Hide
Wrong Answer
Explanation: All of the above options are concurrency-based protocols.
50.
Which of the following is not a valid SQL type?
NUMERIC
DECIMAL
CHARACTER
None of the above
Hide
Wrong Answer
Explanation: DECIMAL is not a valid SQL type.
51.
What is the full form of SQL?
Structured Query Language
Sample Query Language
Structured Query List
None of the above.
Hide
Wrong Answer
Explanation: SQL is the abbreviation for Structured Query Language.
52.
Which of the following is not a DDL command?
REVOKE
GRANT
UPDATE
RENAME
Hide
Wrong Answer
Explanation: RENAME is not a DDL command.
53.
Which of the following are TCL commands?
ROLLBACK
SAVEPOINT
Both A and B
None of the above
Hide
Wrong Answer
Explanation: Both A and B are TCL commands.
54.
SQL views are also known as?
Schema
Virtual Table
Instance
None of the above
Hide
Wrong Answer
Explanation: SQL Views are also known as Virtual Table.
55.
Which of the following is not a valid aggregate function?
count()
Sum()
Avg()
None of the above
Hide
Wrong Answer
Explanation: All of the above options are valid aggregate functions in SQL.

1) What is the full form of SQL?

a. Structured Query List


b. Structure Query Language
c. Sample Query Language
d. None of these.

Hide Answer Workspace

Answer: B

Explanation: SQL is a programming language used for managing data in a relational


database management system. It is pronounced as See-Qwell.

2) Which of the following is not a valid SQL type?


a. FLOAT
b. NUMERIC
c. DECIMAL
d. CHARACTER

Hide Answer Workspace

Answer: C

Explanation:

DECIMAL is not a valid SQL type because it is nothing but numeric only in SQL.

NUMERIC has fixed precision, and scale numbers range from -10^38+1 to 10^38-1.

FLOAT has floating precision number ranges from -1.79E + 308 to 1.79E + 308.

CHARACTER is a fixed-width character string data type that can be up to 8000 characters.

3) Which of the following is not a DDL command?

a. TRUNCATE
b. ALTER
c. CREATE
d. UPDATE

Hide Answer Workspace

Answer: D

Explanation: DDL commands are used to define the structure of the database, table,
schemas, etc. It enables us to perform the operations like CREATE, DROP, ALTER, RENAME,
and TRUNCATE schema objects.

An UPDATE command is used for managing the data stored in a database. It is an example
of a DML command that also includes the INSERT and DELETE commands.
4) Which of the following are TCL commands?

a. COMMIT and ROLLBACK


b. UPDATE and TRUNCATE
c. SELECT and INSERT
d. GRANT and REVOKE

Hide Answer Workspace

Answer: A

Explanation: TCL stands for Transaction Control Commands used for managing the
changes made by DML commands like INSERT, DELETE, and UPDATE. The TCL commands
are automatically committed in the database; that's why we cannot use them directly while
creating tables or dropping them.

5) Which statement is used to delete all rows in a table without having the action logged?

a. DELETE
b. REMOVE
c. DROP
d. TRUNCATE

Hide Answer Workspace

Answer: D

Explanation: TRUNCATE statement removes all rows in a table without logging the
individual row deletions. It uses fewer system and transaction log resources, which makes
its execution fast. This statement is similar to the DELETE statement without the WHERE
clause.

6) SQL Views are also known as

a. Simple tables
b. Virtual tables
c. Complex tables
d. Actual Tables

Hide Answer Workspace

Answer: B

Explanation: A view is also known as a virtual table because it contains rows and columns
similar to a real table. It shows the table interface but cannot be stored in a database.

7) How many Primary keys can have in a table?

a. Only 1
b. Only 2
c. Depends on no of Columns
d. Depends on DBA

Hide Answer Workspace

Answer: A

Explanation: The primary key can consist of a single or combination of the field that
uniquely identifies each record in a table. It cannot be null or empty. A table may have
duplicate columns, but it can contain only one primary key.

8) Which datatype can store unstructured data in a column?

a. CHAR
b. RAW
c. NUMERIC
d. VARCHAR

Hide Answer Workspace


Answer: B

Explanation:

RAW datatype stores variable-length binary data that can be queried and inserted but not
manipulated. Its maximum length is 32767 bytes.

CHAR stores character data in a fixed length.

NUMERIC stores numeric values only.

VARCHAR stores variable string data in a fixed length. Its maximum length is 4000 bytes.

9) Which of the following is not Constraint in SQL?

a. Primary Key
b. Not Null
c. Check
d. Union

Hide Answer Workspace

Answer: D

Explanation:

Constraint specifies the rule to allow or restrict what data will be stored in a table. The
PRIMARY KEY, NOT NULL, and CHECK are the constraints that specify rules for data
insertion.

UNION is an operator that combines two or more results from multiple SELECT queries
into a single result set.

10) Which of the following is not a valid aggregate function?

a. COUNT
b. COMPUTE
c. SUM
d. MAX

Hide Answer Workspace

Answer: B

Explanation: Aggregate function is used to perform calculations on multiple values and


return the output in a single value. It is mostly used with the SELECT statement. COUNT,
SUM, and MAX are all aggregate functions.

COMPUTE is not an aggregate function. It is used to generate totals as an additional


column at the end of the result set.

11) Which data manipulation command is used to combines the records from one or more
tables?

a. SELECT
b. PROJECT
c. JOIN
d. PRODUCT

Hide Answer Workspace

Answer: C

Explanation: JOIN command is used with the SELECT statement to retrieve data from
multiple tables. It must be needed whenever we want to fetch records from two or more
tables.

12) Which operator is used to compare a value to a specified list of values?

a. ANY
b. BETWEEN
c. ALL
d. IN

Hide Answer Workspace

Answer: D

Explanation: The IN operator easily tests the expression if it matches any value in a
specified list of values. It reduces the use of multiple OR conditions.

The WHERE or HAVING clause uses the ANY and ALL operators. ANY gives the result when
any subquery value matches the specified condition. The ALL give the result when all
subquery values match the specified condition.

The BETWEEN operator selects values only in the given range.

13) What operator tests column for absence of data

a. NOT Operator
b. Exists Operator
c. IS NULL Operator
d. None of the above

Hide Answer Workspace

Answer: C

Explanation: The IS NULL operator is used to testing the empty values in the table's
column. It returns true if column values are NULL.

The NOT operator gives the result only when the specified condition is not true.

The EXISTS operator used in combination with a subquery, and if a subquery returns any
record, this operator returns true. Otherwise, it will return false.

14) In which of the following cases a DML statement is not executed?

a. When existing rows are modified.


b. When a table is deleted.
c. When some rows are deleted.
d. All of the above

Hide Answer Workspace

Answer: B

Explanation: The DML statement is used to access and manipulate the data in an existing
table. Therefore, it cannot be used in table deletion.

15) If we have not specified ASC or DESC after a SQL ORDER BY clause, the following is used
by default

a. DESC
b. ASC
c. There is no default value
d. None of the mentioned

Hide Answer Workspace

Answer: B

Explanation: If we have not specified any sorting with the ORDER BY clause, SQL always
uses the ASC as a default sorting order. SQL treats Null as the lowest possible values while
sorting.

16) Which of the following statement is true?

a. TRUNCATE free the table space while DELETE does not.


b. Both TRUNCATE and DELETE statements free the table's space.
c. Both TRUNCATE and DELETE statement does not free the table's space.
d. DELETE free the table space while TRUNCATE does not.

Hide Answer Workspace


Answer: A

Explanation:

The TRUNCATE statement in SQL removes all data from the table and free the table's
space.

SQL's DELETE statement removes all data from the table but does not free the table's
space.

17) What is returned by INSTR ('JAVAT POINT', 'P')?

a. 6
b. 7
c. POINT
d. JAVAT

Hide Answer Workspace

Answer: B

Explanation: The INSTR function searches the string for substring and returns the
numeric value of the specified character's first occurrence.

18) A command that lets you change one or more field in a table is:

a. INSERT
b. MODIFY
c. LOOK-UP
d. All of the above

Hide Answer Workspace

Answer: B
Explanation: The modify command is used to change one or more columns in the
existing table. It is generally used with ALTER TABLE statement as follows.

LTER TABLE table_name MODIFY column_name column_type;

19) Which of the following is also called an INNER JOIN?

a. SELF JOIN
b. EQUI JOIN
c. NON-EQUI JOIN
d. None of the above

Hide Answer Workspace

Answer: B

Explanation: The INNER JOIN returns data from the two or more tables that match the
specified condition and hides other records. EQUI JOIN is similar to INNER JOIN that
returns records for equality or matching column(s) values of the relative tables.

NON-EQUI JOIN is returned those records that are not matching in the relative tables.

SELF JOIN returns records from the tables by joining itself.

20) Which of the following is true about the HAVING clause?

a. Similar to the WHERE clause but is used for columns rather than groups.
b. Similar to WHERE clause but is used for rows rather than columns.
c. Similar to WHERE clause but is used for groups rather than rows.
d. Acts exactly like a WHERE clause.

Hide Answer Workspace

Answer: C

Explanation: The HAVING clause is always used with the GROUP BY clause and returns
the rows where the condition is TRUE.
21) _______ clause creates temporary relation for the query on which it is defined.

a. WITH
b. FROM
c. WHERE
d. SELECT

Hide Answer Workspace

Answer: A

Explanation: The WITH clause in SQL allows us to provide a sub-query block, a name that
can be referenced in several places within the main query. It is used for defining a
temporary relation whose definition is available by the query in which the WITH clause is
associated.

22) The SQL statement:

1. SELECT ROUND (65.726, -1) FROM DUAL;

Prints:

a. is illegal
b. garbage
c. 726
d. 70

Hide Answer Workspace

Answer: D

Explanation: Here, the ROUND() function statement will produce the rounded result of
the given number 65.726 from the left of decimal point up to 1.
23) Which of the following is true about the SQL AS clause?

a. The AS clause in SQL is used to change the column name in the output or assign a
name to a derived column.
b. The SQL AS clause can only be used with the JOIN clause.
c. The AS clause in SQL is used to defines a search condition.
d. All of the mentioned

Hide Answer Workspace

Answer: A

Explanation: SQL AS clauses are defined for columns and tables to give an alias name.
Basically, aliases are created to increase the readability of the query and column headings
in the output.

24) _________ command makes the updates performed by the transaction permanent in the
database?

a. ROLLBACK
b. COMMIT
c. TRUNCATE
d. DELETE

Hide Answer Workspace

Answer: B

Explanation:

The COMMIT statement is a transactional command used to end the current transaction
and make all changes performed in the transaction permanent.

The ROLLBACK statement is a transactional command used to back out or cancels the
current transaction changes and restores changed data in its previous state.

TRUNCATE and DELETE are not transactional commands.


25) How can you change "Thomas" into "Michel" in the "LastName" column in the Users table?

a. UPDATE User SET LastName = 'Thomas' INTO LastName = 'Michel'


b. MODIFY Users SET LastName = 'Michel' WHERE LastName = 'Thomas'
c. MODIFY Users SET LastName = 'Thomas' INTO LastName = 'Michel'
d. UPDATE Users SET LastName = 'Michel' WHERE LastName = 'Thomas'

Hide Answer Workspace

Answer: D

Explanation: The UPDATE statement is used for modifying the table data by using the
SET and WHERE clause. The SET clause is used to change the values of the column
specified in the WHERE clause. See the below syntax:

UPDATE table SET column1 = expression1, column2 = expression2,... WHERE


conditions

26) Which command is used to change the definition of a table in SQL?

a. CREATE
b. UPDATE
c. ALTER
d. SELECT

Hide Answer Workspace

Answer: C

Explanation: The ALTER statement is used to change our table's definition, such as table
name, column name, column constraint, etc. It also allows us to add or delete an existing
column in a table. This statement must be used with ADD, DROP, and MODIFY clauses
according to the situation.

27) Which type of JOIN is used to returns rows that do not have matching values?
a. Natural JOIN
b. Outer JOIN
c. EQUI JOIN
d. All of the above

Hide Answer Workspace

Answer: B

Explanation:

OUTER JOIN is the only join that returned the unmatched rows in one or both tables. It
can be classified into the following types:

o LEFT JOIN that shows only the unmatched rows from the left table.
o RIGHT JOIN that shows only the unmatched rows from the right table.
o FULL OUTER JOIN that shows the unmatched rows from both tables.

EQUI JOIN shows records for equality or matching column(s) values of the relative tables.

A Natural join can only be performed if at least one common attribute exists between two
relations (the attributes should be the same name and domain).

28) A CASE SQL statement is ________?

a. A way to establish a loop in SQL.


b. A way to establish an IF-THEN-ELSE in SQL
c. A way to establish a data definition in SQL
d. All of the above.

Hide Answer Workspace

Answer: B

Explanation: A CASE statement is one of the control flow function that allows us to write
an if-else or if-then-else logic in a SQL query. This expression validates various conditions
and shows the output when the first condition is true, and stops traversing. If any
condition is not true, it executes the else block. It shows a null value if the else block is
not found.

29) Which statement is true regarding routines and triggers?

a. Both run automatically.


b. Both are stored in the database.
c. Both consist of procedural code.
d. Both have to be called to operate.

Hide Answer Workspace

Answer: C

Explanation:

Routines, also known as subroutines, are the group of multiple commands that can be
called whenever required.

Triggers are a special type of stored procedure containing a set of SQL statements that
will be fired automatically whenever any database event occurs. It always resides in the
system catalog.

So option C is the correct choice.

30) Which statement is true regarding procedures?

a. They include procedural and SQL statements.


b. They work similarly to the functions.
c. It does not need unique names.
d. It cannot be created with SQL statements.

Hide Answer Workspace

Answer: A
Explanation: A procedure is a prepared SQL code that can be saved in the system and
reused whenever needed. It can return one or more values through parameters. So option
A is the correct choice.

31) Which of the following is the basic approaches for joining tables?

a. Union JOIN
b. Natural JOIN
c. Subqueries
d. All of the above

Hide Answer Workspace

Answer: D

Explanation:

We already know that Union and Natural are the approaches for joining two or more
tables.

A subquery is a query nested into another SQL query. It can be embedded with SELECT,
INSERT, UPDATE or DELETE statement. A subquery is known as the inner query. In many
cases, we can use the subquery instead of a JOIN. Therefore, option D is the correct choice.

32) Why we need to create an index if the primary key is already present in a table?

a. Index improves the speed of data retrieval operations on a table.


b. Indexes are special lookup tables that will be used by the database search engine.
c. Indexes are synonyms of a column in a table.
d. All of the above

Hide Answer Workspace

Answer: A
Explanation: When we define a primary key in a table, the Database Engine enforces the
data's uniqueness by creating a unique index for those columns. This indexing process
improves data retrieval when the primary key is used in queries. Therefore, we need to
create an index if a primary key is already present in a table.

33) Group of operations that form a single logical unit of work is known as

a. View
b. Network
c. Unit
d. Transaction

Hide Answer Workspace

Answer: D

Explanation: A transaction is a sequential group of statements such as select, insert,


update or delete to perform as one single logical unit of work that can be committed or
rolled back

34) Shared locks are applied while performing

a. Read operations
b. Write operations
c. A & B both
d. None of the above

Hide Answer Workspace

Answer: A

Explanation: A shared lock can only be applied while reading or changing in data is
performed. It is also known as the READ lock. Therefore, option A is the right choice.
35) Sequence can generate

a. Numeric value
b. Alphanumeric value
c. A & B both
d. None of the above

Hide Answer Workspace

Answer: C

Explanation: A sequence is an arrangement of integers that generates unique values


(numeric or alphanumeric) in ascending order on specific demand.

36) A sequence in SQL can generate a maximum number:

a. 39 digits
b. 38 digits
c. 40 digits
d. 37 digits

Hide Answer Workspace

Answer: B

Explanation: The number generated using a sequence can have a maximum of 38 digits.

37) Which of the following is the correct order of a SQL statement?

a. SELECT, GROUP BY, WHERE, HAVING


b. SELECT, WHERE, GROUP BY, HAVING
c. SELECT, HAVING, WHERE, GROUP BY
d. SELECT, WHERE, HAVING, GROUP BY
Hide Answer Workspace

Answer: B

Explanation: In SQL statements, the WHERE clause always comes before GROUP BY, and
the HAVING clause always comes after GROUP BY. Therefore, option B is the correct
choice.

38) What is the difference between a PRIMARY KEY and a UNIQUE KEY?

a. Primary key can store null value, whereas a unique key cannot store null value.
b. We can have only one primary key in a table while we can have multiple unique
keys
c. Primary key cannot be a date variable whereas unique key can be
d. None of these

Hide Answer Workspace

Answer: B

Explanation:

The primary key is a single or combination of the field that identifies each record in a table
uniquely. It cannot take a NULL value. A table can have only one primary key. Also, we can
create a date variable as a primary key in a table.

Unique key also determines each row of the table uniquely, but it can take null value into.
A table can have more than one unique key. We cannot create a date variable as a unique
key in a table.

39) Which of the following are the synonyms for Column and ROW of a table?

1. Row = [Tuple, Record]


2. Column = [Field, Attribute]
3. Row = [Tuple, Attribute]
4. Columns = [Field, Record]

a. 1 and 2
b. 3 and 4
c. Only 1
d. Only 2

Hide Answer Workspace

Answer: A

Explanation: In Database Management System (DBMS), we can say that each record is
also called a tuple and rows. And each column is called fields and attributes.

40) Which operator is used to compare the NULL values in SQL?

a. Equal
b. IN
c. IS
d. None of Above

Hide Answer Workspace

Answer: C

Explanation:

In SQL, we can use the IS operator to compare a NULL. This operator can be used with
select, insert, update, and delete commands.

The IN is a conditional operator used to reduce the use of multiple OR conditions in select,
insert, update, and delete commands.

The EQUAL operator is used to check whether the given expressions are equal or not. The
condition becomes true if the expressions are equal and then return matched records.
41) Which of the following statement is correct regarding the difference between TRUNCATE,
DELETE and DROP command?

I. DELETE operation can be rolled back but TRUNCATE and DROP operations cannot be
rolled back.
II. TRUNCATE and DROP operations can be rolled back but DELETE operations cannot be
rolled back.
III. DELETE is an example of DML, but TRUNCATE and DROP are examples of DDL.
IV. All are an example of DDL.

a. I and III
b. II and III
c. II and IV
d. II and IV

Hide Answer Workspace

Answer: A

Explanation:

DELETE is used to remove existing records from the database. DELETE command is a DML
statement so that it can be rolled back.

DROP is used to delete the whole table, including its structure. DROP is a DDL command
that lost the data permanently, and it cannot be rolled back.

TRUNCATE is used to delete the whole records, but it preserves the table's schema or
structure. TRUNCATE is a DDL command, so it cannot be rolled back.

Hence, option A is the correct answer.

42) Which of the following options are correct regarding these three keys (Primary Key, Super
Key, and Candidate Key) in a database?

I. Minimal super key is a candidate key


II. Only one candidate key can be a primary key
III. All super keys can be a candidate key
IV. We cannot find a primary key from the candidate key
a. I and II
b. II and III
c. I and III
d. II and IV

Hide Answer Workspace

Answer: A

Explanation: Candidate key in SQL is a set of fields that identify each record in a table
uniquely. It is a super key with no repeated fields that means the minimal super key is a
candidate key. A table can contain multiple candidate keys, but it can have only a single
primary key. Therefore option A is the correct choice.

43) When the wildcard in a WHERE clause is useful?

a. When an exact match is required in a SELECT statement.


b. When an exact match is not possible in a SELECT statement.
c. When an exact match is required in a CREATE statement.
d. When an exact match is not possible in a CREATE statement.

Hide Answer Workspace

Answer: B

Explanation: The wildcard is a character used to search complex data from the database
quickly. We can use it in conjunction with the LIKE or NOT LIKE comparison operators and
the WHERE clause to find the result for a specified pattern. Hence, the wildcard is very
useful when the exact match is not possible in the SELECT statement.

44) ______ is NOT a type of constraint in SQL language?

a. FOREIGN KEY
b. PRIMARY KEY
c. UNIQUE
d. ALTERNATE KEY

Hide Answer Workspace

Answer: D

Explanation: ALTERNATE KEY is a key associated with one or more columns to identify
each row in a table uniquely. If a table with one or more candidate keys, then the keys
other than the primary key is an alternate key. Since the alternate key is a part of the
candidate key, it is not a constraint in SQL. Hence, option D is the correct choice.

45) Find the cities name with the condition and temperature from table 'whether' where
condition = sunny or cloudy but temperature >= 60.

a. SELECT city, temperature, condition FROM weather WHERE condition = 'cloudy'


AND condition = 'sunny' OR temperature >= 60
b. SELECT city, temperature, condition FROM weather WHERE condition = 'cloudy'
OR condition = 'sunny' OR temperature >= 60
c. SELECT city, temperature, condition FROM weather WHERE condition = 'sunny' OR
condition = 'cloudy' AND temperature >= 60
d. SELECT city, temperature, condition FROM weather WHERE condition = 'sunny'
AND condition = 'cloudy' AND temperature >= 60

Hide Answer Workspace

Answer: C

Explanation: We know that the AND operator gives the output only when both the first
conditions are true. In contrast, the OR operator gives the output when either the first
condition OR the second condition is true. Hence the option C is the correct choice.

46) Which of the following statement is correct to display all the cities with the condition,
temperature, and humidity whose humidity is in the range of 60 to 75 from the 'whether'
table?

a. SELECT * FROM weather WHERE humidity IN (60 to 75)


b. SELECT * FROM weather WHERE humidity BETWEEN 60 AND 75
c. SELECT * FROM weather WHERE humidity NOT IN (60 AND 75)
d. SELECT * FROM weather WHERE humidity NOT BETWEEN 60 AND 75

Hide Answer Workspace

Answer: B

Explanation:

The BETWEEN is a conditional operator that is used to retrieve values from an expression
within a range. It can be used with the SELECT, INSERT, UPDATE and DELETE statement.

The IN is a conditional operator used to reduce the use of multiple OR conditions in the
SELECT, INSERT, UPDATE and DELETE statement.

Hence the option B is the correct choice.

47) ________ is a program that performs some common action on database data and also
stored in the database.

a. Stored Procedure
b. Trigger
c. Stored Function
d. None of the above

Hide Answer Workspace

Answer: A

Explanation: A stored procedure is a precompiled set of SQL commands that we can save
in our database. It can be reused over and over again whenever we need to perform some
common tasks.

A trigger is also the set of SQL commands that reside in a system catalog, but it will be
invoked automatically in response to an event. It is a special kind of stored procedure.
A stored function is one of the types of stored programs used to encapsulate the common
business rules or formulas reusable in stored programs. It returns a single value or
sometimes does not produce any result.

Hence the option A is the correct choice.

48) Which statement is used to get all data from the student table whose name starts with p?

a. SELECT * FROM student WHERE name LIKE '%p%';


b. SELECT * FROM student WHERE name LIKE 'p%';
c. SELECT * FROM student WHERE name LIKE '_p%';
d. SELECT * FROM student WHERE name LIKE '%p';

Hide Answer Workspace

Answer: B

Explanation: The '%' symbol indicates zero or more characters next to where it will be
used. And the _ symbol is used to match exactly one character. Therefore option B is the
correct choice.

49) What is the advantage of the clustered index?

a. It is fast to update the records.


b. It does not need extra work for SQL queries.
c. It minimizes the page transfer and maximizes the cache hits.
d. None of the above is correct.

Hide Answer Workspace

Answer: C

Explanation: A clustered index is actually a table where the data is stored in rows. It stores
data in only one way based on the key values. It helps us to store data and indexes
simultaneously but takes a long time to update the records. They are scan and index seek
that minimizes the page transfer and maximizes the cache hits. Hence option C is the
correct choice.

50) Evaluate the SQL statement:

1. SELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a,


2. (SELECT dept_id, MAX(sal) maxsal FROM employees GROUP BY dept_id) b
3. WHERE a.dept_id = b.dept_id AND a.sal < b.maxsal;

Which of the following statement is correct?

a. The statement gives an error at line 1.


b. The statement gives an error at line 6.
c. The statement produces the employee name, salary, department ID, and maximum
salary earned in the employee department for all departments that pay less salary
than the maximum salary paid in the company.
d. The statement produces the employee name, salary, department ID, and maximum
salary earned in the employee department for all employees who earn less than
the maximum salary in their department.

Hide Answer Workspace

Answer: D

Explanation: Option D is the correct choice because it is the example of an inline view,
which is the subquery in the FROM clause of the main query.

51) Which of the following are the DATETIME data types that can be used in column
definitions?

a. TIMESTAMP
b. INTERVAL MONTH TO DAY
c. INTERVAL YEAR TO MONTH
d. TIMESTAMP WITH DATABASE TIMEZONE
Hide Answer Workspace

Answer: A, C

Explanation:

Options A and C are correct. It is because they are the DATETIME data types that can be
used to specify column definitions.

Option B cannot be used to specify the column definitions because there are only
INTERVAL DAY TO SECOND and INTERVAL YEAR TO MONTH data types.

Option D cannot be used to specify the column definitions because there are only
TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE data types.

52) Which data dictionary table can be used to show the object privileges granted to the user
on specific columns?

a. USER_TAB_PRIVS_MADE
b. USER_COL_PRIVS_MADE
c. USER_TAB_PRIVS
d. USER_COL_PRIVS

Hide Answer Workspace

Answer: D

Explanation: The USER_COL_PRIVS data dictionary table will display the object privileges
granted to the user on specific columns. The USER_TAB_PRIVS data dictionary table will
display the object privileges granted to the user on the tables. Options A and B are not
data dictionary.

53) Evaluate the SQL statement:

1. SELECT ROUND (TRUNCATE (MOD (1600, 10), -1), 2) FROM dual;

What will be displayed?


a. 0
b. 1
c. 00
d. An error statement

Hide Answer Workspace

Answer: A

Explanation: This statement will give the result 0. A function MOD(1600, 10) returns 0 by
calculating the modulus of 1600 when 1600 is divided by 10 until no further whole number
can be produced. TRUNCATE(x, y) function truncates x to the decimal precision of y.
Finally, the ROUND(x, y) function rounds x to the decimal precision of y. Hence option A
is the correct choice.

54) What is the need for our query to execute successfully on an existing view?

a. The specified table must contain data.


b. We must have a SELECT privilege on the view.
c. We should have a SELECT privilege only on the specified table.
d. The specified table must be in the same database or schema.

Hide Answer Workspace

Answer: B

Explanation: It is required to have a SELECT privilege to query on the existing view. Hence
option B is the right choice.

55) Which of the following operator can be used with a multiple-row subquery?

a. =
b. BETWEEN
c. NOT IN
d. <>

Hide Answer Workspace

Answer: C

Explanation: The multiple-row subqueries produces multiple rows of results. We can only
use the NOT IN operator in SQL can only be used with multiple-row subqueries. And all
other operators must be used with single row subquery only. Therefore, BETWEEN, '=',
and '<>' operators work with single row subquery. Hence option C is the correct choice.

56) _______ is a constraint that can be defined only at the column level?

a. UNIQUE
b. NOT NULL
c. CHECK
d. PRIMARY KEY

Hide Answer Workspace

Answer: B

Explanation: The SQL NOT NULL constraint prevents inserting NULL values into the
specified column. It enforces that a value must be defined for this column cannot accept
a NULL value. Hence, we can say that the NOT NULL constraint can be defined only at the
column level.

Which of the following is TRUE about Pattern Matching in SQL?

A. In SQL, pattern matching is performed with LIKE clauses.


B. An SQL query usually begins with a LIKE clause before a WHERE clause
C. Using the LIKE clause in an SQL query, we compare the pattern in the query
with the pattern present in a table.
D. All of the above

Answer: D) All of the above


Explanation:

In case of Pattern Matching:

1. In SQL, pattern matching is performed with LIKE clauses.


2. An SQL query usually begins with a LIKE clause before a WHERE clause
3. Using the LIKE clause in an SQL query, we compare the pattern in the query
with the pattern present in a table.

Discuss this Question

2. It is possible to use LIKE clauses with –

A. Strings
B. Numbers
C. Both A. and B.
D. None of the above

Answer: C) Both A. and B.

Explanation:

It is possible to use LIKE clauses with strings and numbers.

Discuss this Question

3. In LIKE clause, to represent a zero, a character, or a number of characters


___ is used.

A. /
B. _
C. *
D. %

Answer: D) %
Explanation:

In LIKE clause, to represent a zero, a character, or a number of characters % is


used.

Discuss this Question

4. In LIKE clause, to represent a single character, _____ is used.

A. -
B. _
C. !
D. &

Answer: B) _

Explanation:

In LIKE clause, to represent a single character, _ is used.

Discuss this Question

5. LIKE clause can be used with –

A. % operator
B. _ operator
C. NOT operator
D. All of the above

Answer: D) All of the above

Explanation:

LIKE clause can be used with % , _ and NOT operators.

Discuss this Question


ADVERTISEMENT

6. What does the following statement do?

WHERE CustomerName LIKE 'a%'

A. Finds any values that start with "a"


B. Finds any values that start with "a%"
C. Finds any values that contains only two characters starting with "a"
D. All of the above

Answer: A) Finds any values that start with "a"

Explanation:

The above statement finds any values that start with "a"

Discuss this Question

7. What does the following statement do?

WHERE CustomerName LIKE '%a'

A. Finds any values that end with "a"


B. Finds any values whose second character is "a"
C. Find any values that contains only two characters ending with "a"
D. Mysql > Savepoint ini;

Answer: A) Finds any values that end with "a"

Explanation:

The above statement finds any values that end with "a"

Discuss this Question


8. What does the following statement do?

WHERE CustomerName LIKE '%or%'

A. Finds any values that start with "or"


B. Finds any value that contains only four characters and second, third
characters are 'o', 'r'
C. Finds any values that have "or" in any position
D. None of the above

Answer: C) Finds any values that have "or" in any position

Explanation:

The above statement finds any values that have "or" in any position

Discuss this Question

9. What does the following statement do?

WHERE CustomerName LIKE 'a_%'

A. Finds any values that start with "a"


B. Finds any values that start with "a%"
C. Finds any values that start with "a" and are at least 2 characters in length
D. All of the above

Answer: C) Finds any values that start with "a" and are at least 2 characters in
length

Explanation:

The above statement finds any values that start with "a" and are at least 2
characters in length

Discuss this Question


10. What does the following statement do?

WHERE ContactName LIKE 'a%o'

A. Finds any values that start with "a" and ends with "o"
B. Finds any values whose first character is "a" and third character is "o"
C. Both A. and B.
D. None of the above

Answer: A) Finds any values that start with "a" and ends with "o"

Explanation:

The above statement finds any values that start with "a" and ends with "o"

1. To connect strings, which function is used –

A. CONNECT
B. ADD
C. COMBINE
D. CONCAT

Answer: D) CONCAT

Explanation:

To connect strings, CONCAT function is used.

Discuss this Question

2. Which of the following is TRUE about SQL Concatenate?

A. It is also possible to combine more than two strings into one string.
B. Two columns of the table may be used to store the strings that are to be
combined, or they may just be stored individually without being stored
into the table.
C. When the concatenated strings are stored in separate columns of a table,
they are stored in the column in which they were initially stored.
D. All of the above

Answer: D) All of the above

Explanation:

In case of SQL Concatenate:

1. It is also possible to combine more than two strings into one string.
2. Two columns of the table may be used to store the strings that are to be
combined, or they may just be stored individually without being stored
into the table.
3. When the concatenated strings are stored in separate columns of a table,
they are stored in the column in which they were initially stored.

Discuss this Question

3. Which function is used to obtain the month from the entire data stored in
a table's column?

A. DATE
B. TIME
C. MONTH
D. DATE & TIME

Answer: C) MONTH

Explanation:

MONTH function is used to obtain the month from the entire data stored in a
table's column.

Discuss this Question

4. In more readable form, you can retrieve the date values, using ______
function?
A. DATE
B. DATE_FORM
C. DATE_FORMAT
D. DATE_VALUE

Answer: C) DATE_FORMAT

Explanation:

In more readable form, you can retrieve the date values, using DATE_FORMAT
function.

Discuss this Question

5. Savepoint command is used with _____ command.

A. Commit
B. Transaction
C. Rollback
D. None of the above

Answer: C) Rollback

Explanation:

Savepoint command is used with Rollback command.

Discuss this Question

ADVERTISEMENT

6. Which of the following is TRUE about Savepoint command?

A. A transaction is marked in a table by this TCL command.


B. Imagine that you are making a long table, and you want to roll back only
to a specific point in the table. You can do this with the savepoint.
C. In order to rollback part of a table rather than the entire table, a savepoint
is useful.
D. All of the above

Answer: D) All of the above

Explanation:

Some of the points about Savepoint command are:

1. A transaction is marked in a table by this TCL command.


2. Imagine that you are making a long table, and you want to roll back only
to a specific point in the table. You can do this with the savepoint.
3. In order to rollback part of a table rather than the entire table, a savepoint
is useful.

Discuss this Question

7. Select the correct syntax for Savepoint.

A. Mysql > Transaction ini;


B. Mysql > &Savepoint;
C. Mysql > START Transaction;
D. Mysql > Savepoint ini;

Answer: D) Mysql > Savepoint ini;

Explanation:

Mysql > Savepoint ini; is the correct syntax for Savepoint.

Discuss this Question

8. By default, TIME data type stores time in which format?

A. MM:HH:SS;
B. SS:HH:MM;
C. HH:SS:MM;
D. HH:MM:SS;

Answer: D) HH:MM:SS;

Explanation:

By default, TIME data type stores time in HH:MM:SS format.

Discuss this Question

9. It is possible to retrieve time in a more readable format, using which


function?

A. TIME
B. TIME_FORM
C. TIME_FORMAT
D. TIME & DATE

Answer: C) TIME_FORMAT

Explanation:

It is possible to retrieve time in a more readable format, using TIME_FORMAT()


function.

Discuss this Question

10. Using TIME_FORMAT() function, time can be retrieved in –

A. 12-hour format
B. 24-hour format
C. Both A. and B.
D. None of the above
Answer: C) Both A. and B.

Explanation:

Using TIME_FORMAT() function, time can be retrieved in 12-hour and 24-hour


formats.

1. SQL BETWEEN is a ______ operator.

A. Relational
B. Logical
C. Arithmetic
D. Assignment

Answer: B) Logical

Explanation:

SQL BETWEEN is a logical operator and within the range specified in the query, it
retrieves the records from the table.

Discuss this Question

2. SQL BETWEEN operators can be used to select the –

A. Dates
B. Texts
C. Numbers
D. All of the above

Answer: D) All of the above

Explanation:

SQL BETWEEN operators can be used to select the dates, texts or numbers.

Discuss this Question


3. SQL BETWEEN operators include –

A. Starting Value
B. In Between Value
C. Ending Value
D. All of the above

Answer: D) All of the above

Explanation:

SQL BETWEEN operators include the starting value, in between value and the
ending value.

Discuss this Question

4. In which clause does the BETWEEN operator is used?

A. IF
B. AS
C. WHERE
D. EXCEPT

Answer: C) WHERE

Explanation:

In WHERE clause, BETWEEN operator is used.

Discuss this Question

5. BETWEEN operator is used with which SQL Statements –

A. SELECT
B. DELETE
C. INSERT
D. All of the above

Answer: D) All of the above

Explanation:

BETWEEN operators is used with SELECT, DELETE and INSERT SQL Statements.

Discuss this Question

ADVERTISEMENT

6. BETWEEN Operator returns the TRUE value if the column value is –

A. <=Value1 & >=Value2


B. <=Value1 & <=Value2
C. >=Value1 & >=Value2
D. >=Value1 & <=Value2

Answer: D) >=Value1 & <=Value2

Explanation:

BETWEEN Operator returns the TRUE value if the column value is >=Value1 &
<=Value2.

Discuss this Question

7. In CRUD Operator, U is an acronym of –

A. Upper
B. Unique
C. Update
D. Uppercase

Answer: C) Update
Explanation:

U in CRUD Operator refers to Update.

Discuss this Question

8. C in CRUD Operator means –

A. To add or insert data


B. To retrieve or fetch data
C. To update the data
D. To delete the data

Answer: A) To add or insert data

Explanation:

C in CRUD Operator is an acronym of Create which means to add or insert data in


the table.

Discuss this Question

9. Read in CRUD Operator means –

A. To retrieve data
B. To fetch data
C. Both A. and B.
D. None of the above

Answer: C) Both A. and B.

Explanation:

Read in CRUD Operator means to retrieve and fetch the data from the table.

Discuss this Question


10. Using the DELETE Query from the CRUD Operator, we can delete –

A. Only one row


B. All the rows
C. Only two rows
D. None of the above

Answer: B) All the rows

Explanation:

Using the DELETE Query from the CRUD Operator, we can delete all the rows
from the table.

1. A Sub query is an SQL expression that is placed ____ another SQL


statement.

A. Before
B. After
C. Inside
D. Outside

Answer: C) Inside

Explanation:

A Sub query is an SQL expression that is placed inside another SQL statement.

Discuss this Question

2. With which of the following statement(s) can the SQL sub queries be
used?

A. SELECT
B. UPDATE
C. INSERT
D. All of the above

Answer: D) All of the above

Explanation:

SQL sub queries can be used with SELECT, UPDATE, INSERT and DELETE
statements.

Discuss this Question

3. Whenever a sub query appears in SQL, it is enclosed within ____ and


placed to the ____ of the SQL operators.

A. Brackets, Left
B. Brackets, Right
C. Parenthesis, Left
D. Parenthesis, Right

Answer: D) Parenthesis, Right

Explanation:

Whenever a sub query appears in SQL, it is enclosed within parenthesis and


placed to the right of the SQL operators.

Discuss this Question

4. Which of the following clause cannot be used in SQL sub queries?

A. GROUP BY
B. ORDER BY
C. DELETE
D. FROM

Answer: B) ORDER BY
Explanation:

ORDER BY clause cannot be used in SQL sub queries.

Discuss this Question

5. In order to prevent multiple records from being returned by the sub


query, ____ must be used before the sub query.

A. Many Value Operators


B. Multiple Value Operators
C. Single Value Operator
D. Unique Value Operator

Answer: B) Multiple Value Operators

Explanation:

In order to prevent multiple records from being returned by the sub query,
multiple value operators must be used before the sub query.

Discuss this Question

ADVERTISEMENT

6. The ____ operator cannot be used with the sub query, but within it.

A. IN
B. INTO
C. BETWEEN
D. JOIN

Answer: C) BETWEEN

Explanation:

The BETWEEN operator cannot be used with the sub query, but within it.
Discuss this Question

7. An SQL ____ is a virtual table, whose contents are based on the SQL
statement's results.

A. Concatenate
B. Virtual
C. View
D. None of the above

Answer: C) View

Explanation:

An SQL View is a virtual table, whose contents are based on the SQL statement's
results.

Discuss this Question

8. We can create View in SQL using –

A. CREATE statement
B. CREATE VIEW statement
C. VIEW CREATE statement
D. SQL VIEW statement

Answer: B) CREATE VIEW statement

Explanation:

We can create View in SQL using CREATE VIEW statement.

Discuss this Question

9. What is TRUE about UPDATE in SQL VIEW?


A. Views that depend on a single table can be updated.
B. An update of a view created from more than one table will not be allowed
by SQL.
C. There should be no NULL values in the fields of view.
D. All of the above

Answer: D) All of the above

Explanation:

UPDATE in SQL VIEW states that-

i. Views that depend on a single table can be updated.


ii. An update of a view created from more than one table will not be allowed
by SQL.
iii. There should be no NULL values in the fields of view.

Discuss this Question

10. When SELECT statements used to create Views contain ____ clauses, the
views cannot be updated.

A. JOIN
B. HAVING
C. GROUP BY
D. All of the above

Answer: D) All of the above

Explanation:

When SELECT statements used to create Views contain JOIN, HAVING, or GROUP
BY clauses, the views cannot be updated.

1. By constraining a SQL statement, we limit the ____ according to certain


conditions or restrictions.

A. Row
B. Column
C. Table
D. Database

Answer: D) Database

Explanation:

By constraining a SQL statement we limit the database according to certain


conditions or restrictions.

Discuss this Question

2. Which of the following is/are type of SQL Constraint?

A. Column Level
B. Table Level
C. Both A and B
D. None of the above

Answer: C) Both A and B

Explanation:

SQL Constraints can be categorized in two types:

i. Column Level Constraint


ii. Table Level Constraint

Discuss this Question

3. What is the difference between Column Level and Table Level


Constraints?

A. Constraints are applied to a single row using Column Level Constraints


whereas Multiple rows can be constrained using a Table Level Constraint.
B. Constraints are applied to multiple rows using Column Level Constraints
whereas a single row can be constrained using a Table Level Constraint.
C. Constraints are applied to a single column using Column Level Constraints
whereas Multiple columns can be constrained using a Table Level
Constraint.
D. Constraints are applied to multiple columns using Column Level
Constraints whereas only a single column can be constrained using a Table
Level Constraint.

Answer: C) Constraints are applied to a single column using Column Level


Constraints whereas Multiple columns can be constrained using a Table Level
Constraint

Explanation:

Constraints are applied to a single column using Column Level Constraints


whereas Multiple columns can be constrained using a Table Level Constraint.

Discuss this Question

4. Which of the following constraints are TRUE to be put in Password


system?

A. One uppercase character must be included in the password.


B. An eight-character minimum password is required.
C. At least one symbol must appear in the password.
D. All of the above

Answer: D) All of the above

Explanation:

The constraints that are needed to be put in the Password system are:

i. One uppercase character must be included in the password.


ii. An eight-character minimum password is required.
iii. At least one symbol must appear in the password.
Discuss this Question

5. Select the correct constraint in SQL?

A. NOT NULL
B. CHECK
C. DEFAULT
D. All of the above

Answer: D) All of the above

Explanation:

The constraints available in SQL are:

i. CHECK
ii. CREATE INDEX
iii. DEFAULT
iv. FOREIGN KEY
v. NOT NULL
vi. PRIMARY KEY
vii. UNIQUE

Discuss this Question

ADVERTISEMENT

6. What is TRUE about NOT NULL Constraint?

A. In columns that are subject to the NOT NULL constraint, duplicate values
are not allowed.
B. When a table's column is declared as NOT NULL, no record in the table can
have an empty value for that column.
C. By applying the NOT NULL constraint, we will always ensure that the
column contains a unique value and won't allow nulls.
D. The value will first be checked for certain conditions before inserting it into
the column when a NOT NULL constraint applies to a column in the table.

Answer: B) When a table's column is declared as NOT NULL, no record in the


table can have an empty value for that column

Explanation:

When a table's column is declared as NOT NULL, no record in the table can have
an empty value for that column.

Discuss this Question

7. NULL means –

A. ZERO
B. -1
C. 1
D. Empty

Answer: D) Empty

Explanation:

NULL means empty, not even zero.

Discuss this Question

8. Which of the following is TRUE about UNIQUE constraint?

A. In columns that are subject to the UNIQUE constraint, duplicate values are
not allowed.
B. Unique values will always be present in the column containing the unique
constraint.
C. A single table can have more than one unique constraint, since it can be
applied to more than one column.
D. All of the above

Answer: D) All of the above

Explanation:

In case of UNIQUE constraint:

i. In columns that are subject to the UNIQUE constraint, duplicate values are
not allowed.
ii. Unique values will always be present in the column containing the unique
constraint.
iii. A single table can have more than one unique constraint, since it can be
applied to more than one column.

Discuss this Question

9. You can also ____ the existing tables by using the UNIQUE constraint.

A. Change
B. Delete
C. Modify
D. Drop

Answer: C) Modify

Explanation:

You can also modify the existing tables by using the UNIQUE constraint.

Discuss this Question

10. ____ and ____constraints form the core of the PRIMARY KEY constraint.

A. NOT NULL , CHECK


B. NOT NULL , DEFAULT
C. NOT NULL , FOREIGN KEY
D. NOT NULL , UNIQUE

Answer: D) NOT NULL , UNIQUE

Explanation:

NOT NULL and UNIQUE constraints form the core of the PRIMARY KEY constraint.

Discuss this Question

11. ____ integrity is achieved by using a foreign key.

A. Referential Integrity
B. Domain Integrity
C. User-defined Integrity
D. Entity Integrity

Answer: A) Referential Integrity

Explanation:

Referential integrity is achieved by using a foreign key.

Discuss this Question

12. What is TRUE about DEFAULT constraint?

A. The value will first be checked for certain conditions before inserting it into
the column when a DEFAULT constraint applies to a column in the table.
B. In the event of a DEFAULT constraint being applied to a table's column
without a user specifying the value to be inserted when that constraint was
applied, the default value that was specified when the constraint was
applied will be put into that column.
C. An index can be created on the table using the DEFAULT constraint.
D. None of the above
Answer: B) In the event of a DEFAULT constraint being applied to a table's
column without a user specifying the value to be inserted when that constraint
was applied, the default value that was specified when the constraint was applied
will be put into that column

Explanation:

In the event of a default constraint is applied to a table's column without a user


specifying the value to be inserted when that constraint was applied, the default
value that was specified when the constraint was applied will be put into that
column.

1. To get a record from one table, which is not present in another table, we
can use the clause –

A. CONCAT
B. COPY
C. EXCEPT
D. ALTER

Answer: C) EXCEPT

Explanation:

To get a record from one table, which is not present in the other table, we can
use the clause EXCEPT.

Discuss this Question

2. SQL EXCEPT statement behaves similar to _____operator in mathematics.

A. Sum
B. Multiply
C. Minus
D. Divide

Answer: C) Minus
Explanation:

SQL EXCEPT statement behaves similar to Minus operator in mathematics.

Discuss this Question

3. Select the correct rule of SQL EXCEPT.

A. There must be the same number of columns in each table and the same
order in every select statement.
B. It is desirable that the columns have similar or compatible data types.
C. Both SELECT statements must have the same fields in their respective
columns.
D. All of the above

Answer: D) All of the above

Explanation:

Rules of SQL EXCEPT are:

i. There must be the same number of columns in each table and the same
order in every select statement.
ii. It is desirable that the columns have similar or compatible data types.
iii. Both SELECT statements must have the same fields in their respective
columns.

Discuss this Question

4. Select the correct syntax of SQL EXCEPT.

A. SELECT Column1 FROM Table1


B. SELECT Column2 FROM Table2
C. EXCEPT;
D. EXCEPT
E. SELECT Column1 FROM Table1
F. SELECT Column2 FROM Table2;
G. SELECT Column1 FROM Table1
H. EXCEPT
I. SELECT Column2 FROM Table2;
J. None of the above

Answer: C)

Explanation:

The correct syntax of SQL EXCEPT is,

SELECT Column1 FROM Table1


EXCEPT
SELECT Column2 FROM Table2;

Discuss this Question

5. SQL EXCEPT clause is supported in –

A. MySQL
B. PostgreSQL
C. Both A and B
D. None of the above

Answer: B) PostgreSQL

Explanation:

SQL EXCEPT clause is supported in PostgreSQL and not in MySQL.

Discuss this Question

ADVERTISEMENT

6. What is TRUE about SQL EXCEPT clause?

A. The result is purged of duplicates


B. Duplicate records are not removed
C. Only one column can be compared by a clause
D. None of the above

Answer: A) The result is purged of duplicates

Explanation:

In the case of the SQL EXCEPT clause, the result is purged of duplicates.

Discuss this Question

7. What is TRUE about NOT IN clause?

A. The result is purged of duplicates


B. Duplicate records are not removed
C. Performs column-by-column comparisons
D. None of the above

Answer: B) Duplicate records are not removed

Explanation:

In the case of the NOT IN clause, Duplicate records are not removed.

Discuss this Question

8. ORDER BY clause comes ____ the EXCEPT clause in SQL statement?

A. Before
B. After
C. Flexible to before or after
D. None of the above

Answer: B) After

Explanation:
ORDER BY clauses comes after the EXCEPT clause in SQL statement.

Discuss this Question

9. SQL EXCEPT returns the record from -

A. First SELECT Query


B. Second SELECT Query
C. Third SELECT Query
D. None of the above

Answer: A) First SELECT Query

Explanation:

SQL EXCEPT returns the record from the first SELECT Query which is not present
in the second SELECT Query.

Discuss this Question

10. Using which clause, can SQL EXCEPT be used in single table?

A. TO
B. AS
C. WHERE
D. IN

Answer: C) WHERE

Explanation:

Using WHERE clause, SQL EXCEPT can be used in single table.

1. SQL Indexes slows the execution time of which statement(s)?

A. UPDATE
B. INSERT
C. SELECT
D. Both A and B

Answer: D) Both A and B

Explanation:

SQL Indexes slows the execution time of UPDATE and INSERT statements.

Discuss this Question

2. SQL indexes speed up the execution time of which statement(s)?

A. SELECT
B. WHERE
C. Both A and B
D. None of the above

Answer: C) Both A and B

Explanation:

SQL Indexes speed up the execution time of SELECT and WHERE statements.

Discuss this Question

3. Why index is important in SQL?

A. The large database can be searched quickly with SQL Indexes.


B. The concept below is a quick way to include different values in those
columns.
C. A smaller table may not recognize the performance of an index when used
with an index.
D. All of the above

Answer: D) All of the above


Explanation:

The index is important in SQL because –

i. The large database can be searched quickly with SQL Indexes.


ii. The concept below is a quick way to include different values in those
columns.
iii. A smaller table may not recognize the performance of an index when used
with an index.
iv. Columns (fields) in this data structure are sorted either ascendingly or
descendingly according to their data values. For each value, an entry is
assigned.
v. There are only two columns in each index table. Row_id is the first column,
and indexed-column is the second.

Discuss this Question

4. In order to create the Index, we need to use which command?

A. ALTER
B. UPDATE
C. CREATE
D. ADD

Answer: C) CREATE

Explanation:

In order to create the Index, we need to use the CREATE command.

Discuss this Question

5. Unique Index is similar to –

A. Primary Key
B. Foreign Key
C. Composite Key
D. Alternate Key

Answer: A) Primary Key

Explanation:

Unique Index is similar to Primary Key in SQL.

Discuss this Question

ADVERTISEMENT

6. To rename the Index, we need to use which command?

A. RENAME
B. ALTER
C. UPDATE
D. ADD

Answer: B) ALTER

Explanation:

To rename the Index, we need to use ALTER command.

Discuss this Question

7. In order to remove an index, we need to use which command?

A. REMOVE
B. DELETE
C. DROP
D. DEL

Answer: C) DROP
Explanation:

In order to remove an index, we need to use DROP command.

Discuss this Question

8. Which statement is correct to remove an Index from MySQL Database?

A. DROP INDEX Index_Name;


B. ALTER TABLE Table_Name DROP INDEX Index_Name;
C. DROP INDEX Index_Name ON Table_Name;
D. DROP INDEX Table_Name.Index_Name;

Answer: B) ALTER TABLE Table_Name DROP INDEX Index_Name;

Explanation:

Correct statement to remove an Index from MySQL Database is - ALTER TABLE


Table_Name DROP INDEX Index_Name;

Discuss this Question

9. In the relational database, in order to modify index, we need to use which


command?

A. ALTER
B. MODIFY
C. UPDATE
D. ADD

Answer: A) ALTER

Explanation:

In the relational database, in order to modify index, we need to use ALTER


command.
Discuss this Question

10. Which of the following states the correct situation in which Indexes
should not be used in SQL?

A. When the table is small, it is possible to avoid using SQL indexes.


B. Updates need to be made frequently to the table.
C. When there are a lot of NULL values in a column, indexed should not be
used.
D. All of the above

Answer: D) All of the above

Explanation:

In the case of following situation, Indexes should not be used in SQL –

i. When the table is small, it is possible to avoid using SQL indexes.


ii. Updates need to be made frequently to the table.
iii. When there are a lot of NULL values in a column, indexed should not be
used.

1. SET Operators are used to –

A. Compile the results from two queries


B. Compile the results from three queries
C. Compile the results from four queries
D. Compile the results from five queries

Answer: A) Compile the results from two queries

Explanation:

SET Operators are used to compile the results from two queries.

Discuss this Question


2. Name of the operators in SET Operators is –

A. UNION
B. INTERSECT
C. MINUS
D. All of the above

Answer: D) All of the above

Explanation:

Name of the operators in SET Operators is –

1. UNION
2. INTERSECT
3. MINUS

Discuss this Question

3. Rules that are needed to be followed in SET Operators in SQL are –

A. All columns must be identical in number and order.


B. There must be compatibility between data types.
C. Both A and B
D. None of the above

Answer: C) Both A and B

Explanation:

Rules that are needed to be followed in SET Operators in SQL are –

i. All columns must be identical in number and order.


ii. There must be compatibility between data types.

Discuss this Question


4. Combining the results of ___ select statements will be done using UNION.

A. One
B. Two
C. Three
D. Four

Answer: B) Two

Explanation:

Combining the results of two select statements will be done using UNION.

Discuss this Question

5. What is TRUE about UNION ALL Operator?

A. The results of both queries are combined with this operator.


B. After performing the UNION ALL operation, duplicate rows will not be
removed.
C. Both A and B
D. None of the above

Answer: C) Both A and B

Explanation:

In the case of UNION ALL Operator –

i. The results of both queries are combined with this operator.


ii. After performing the UNION ALL operation, duplicate rows will not be
removed.

Discuss this Question

ADVERTISEMENT
6. A SELECT statement is intersected to use it as a join, but it only returns
the records that are ________ between both statements.

A. Distinct
B. Common
C. Shared
D. Both B and C

Answer: D) Both B and C

Explanation:

A SELECT statement is intersected to use as a join, but it only returns the records
that are common or shared between both statements.

Discuss this Question

7. MINUS Operator displays the rows which are –

A. Detected in the second query, absent in the first query, and there are no
duplications.
B. Detected in the first query, absent in the second query, and there are no
duplications.
C. Detected in the first query, absent in the second query, and there are
duplications.
D. Detected in the second query, absent in the first query, and there are
duplications.

Answer: B) Detected in the first query, absent in the second query, and there are
no duplications

Explanation:

Detected in the first query, absent in the second query, and there are no
duplications.

Discuss this Question


8. What is the difference between UNION & UNION ALL operators?

A. Combining the results of two select statements will be done using UNION
whereas combined records from both queries are returned by UNION ALL
operator.
B. Combining the results of two select statements will be done using UNION
ALL whereas combined records from both queries are returned by UNION
operator.
C. After performing the UNION operation, duplicate rows will not be removed
whereas after performing the UNION ALL operation, duplicate rows will be
removed.
D. None of the above

Answer: A) Combining the results of two select statements will be done using
UNION whereas combined records from both queries are returned by UNION ALL
operator

Explanation:

Difference between UNION & UNION ALL operators is –

i. Combining the results of two select statements will be done using UNION
whereas combined records from both queries are returned by UNION ALL
operator.
ii. After performing the UNION ALL operation, duplicate rows will not be
removed whereas after performing the UNION operation, duplicate rows
will be removed.

1. In how many parts are the SQL functions are divided into?

A. 1
B. 2
C. 3
D. 4

Answer: B) 2
Explanation:

SQL functions are divided into 2 parts, Aggregate, and Scalar Functions.

Discuss this Question

2. ____ value is returned by the SQL Aggregate functions?

A. Single
B. Twice
C. NULL
D. Infinite

Answer: A) Single

Explanation:

Single value is returned by the SQL Aggregate functions.

Discuss this Question

3. Select the Aggregate function(s) among the following.

A. AVG()
B. FIRST()
C. LAST()
D. All of the above

Answer: D) All of the above

Explanation:

AVG(), FIRST() and LAST() are all the aggregate functions.

Discuss this Question


4. What does AVG() function returns?

A. First value of the column


B. Last value of the column
C. Sum of rows of the table
D. Average value of the column

Answer: D) Average value of the column

Explanation:

AVG() function returns the Average value of the column.

Discuss this Question

5. Which function returns the largest value of the column?

A. MIN()
B. MAX()
C. LARGE()
D. AVG()

Answer: B) MAX()

Explanation:

MAX() function returns the largest value of the column.

Discuss this Question

ADVERTISEMENT

6. What does COUNT() function returns?

A. Average value
B. Largest value
C. Smallest value
D. Number of rows

Answer: D) Number of rows

Explanation:

COUNT() function returns the number of rows in the table.

Discuss this Question

7. Select the function which is not the Scalar Function(s)?

A. UCASE()
B. LEN()
C. SUM()
D. NOW()

Answer: C) SUM()

Explanation:

SUM() is aggregate function and not the Scalar function.

Discuss this Question

8. What does UCASE() function do?

A. Converts database field to uppercase


B. Converts database field to lowercase
C. Returns the length of the text field
D. Returns the current date and time

Answer: A) Converts database field to uppercase

Explanation:

UCASE() function converts database field to uppercase.


Discuss this Question

9. ____ function extract characters from the text field.

A. LEN()
B. NOW()
C. MID()
D. FORMAT()

Answer: C) MID()

Explanation:

MID() function extract characters from the text field.

Discuss this Question

10. Which function returns the correct date and time?

A. DATE()
B. NOW()
C. TIME()
D. DATETIME()

Answer: B) NOW()

Explanation:

NOW() function returns the correct date and time.

Discuss this Question

ADVERTISEMENT

11. In order to merge two or more strings, which string function is used?
A. CHAR
B. ALTER
C. CONCAT
D. MERGE

Answer: C) CONCAT

Explanation:

In order to merge two or more strings, CONCAT string function is used.

Discuss this Question

12. We can use literal in the CONCAT function. What does literal refer to?

A. Number
B. Character
C. Date
D. All of the above

Answer: D) All of the above

Explanation:

Literals are the numbers, characters and the data in the CONCAT function.

Discuss this Question

13. What is the symbol of Concatenation Operator?

A. |
B. ||
C. //
D. \\

Answer: B) ||
Explanation:

"||" is the symbol of Concatenation Operator.

Discuss this Question

14. What is the full form of CTE in SQL?

A. Character Table Expressions


B. Character Table Evaluator
C. Common Table Evaluator
D. Common Table Expressions

Answer: D) Common Table Expressions

Explanation:

Common Table Expressions is the full form of CTE in SQL.

Discuss this Question

15. Which clause is needed in CTE SQL syntax?

A. FOR
B. AS
C. WITH
D. TO

Answer: C) WITH

Explanation:

WITH clause is needed in CTE SQL syntax.

Discuss this Question


ADVERTISEMENT

16. In case of ____ data, recursive CTE is used?

A. Round
B. Hierarchal
C. Linear
D. None of the above

Answer: B) Hierarchal

Explanation:

In case of Hierarchal data, recursive CTE is used.

Discuss this Question

17. In case the CTE is wrong, it goes into –

A. Infinite Loop
B. Null State
C. False State
D. True State

Answer: A) Infinite Loop

Explanation:

In case the CTE is wrong, it goes into Infinite Loop.

Discuss this Question

18. In case to prevent the endless loop in CTE, ____ is added.

A. MAXLINEAR
B. MAXROUND
C. MAXRECURSION
D. None of the above

Answer: C) MAXRECURSION

Explanation:

In case to prevent the endless loop in CTE, MAXRECURSION is added.

Discuss this Question

19. From the set of results, in order to remove the duplicate columns, ____
Clause is used.

A. DUPLICATE
B. DISTINCT
C. REMOVE
D. DROP

Answer: B) DISTINCT

Explanation:

From the set of results, in order to remove the duplicate columns, DISTINCT
Clause is used. It is used in conjunction with SELECT keyword.

Discuss this Question

20. Which of the following statement is TRUE about DISTINCT Clause?

A. Returns only Distinct values.


B. Only on the single column, it operates.
C. It can be used with the aggregates such as COUNT, AVG, etc.
D. All of the above

Answer: D) All of the above

Explanation:
i. DISTINCT can return only distinct values.
ii. DISTINCT operates only on the single column
iii. DISTINCT can be used with the aggregates such as COUNT, AVG, etc.

Discuss this Question

ADVERTISEMENT

21. ____ are the columns for the retrieval purpose.

A. Tables
B. WHERE Conditions
C. Expressions
D. None of the above

Answer: C) Expressions

Explanation:

Expressions are the columns for the retrieval purpose.

Discuss this Question

22. Which of the following statement is TRUE about DISTINCT Clause?

A. It cannot ignore the NULL values


B. It can ignore the NULL values
C. Its query can return multiple values
D. None of the above

Answer: A) It cannot ignore the NULL values

Explanation:

DISTINCT Clause cannot ignore the NULL values.

Discuss this Question


23. In order to join N tables, minimum number of join statements required
is –

A. N
B. N-1
C. N-2
D. N+1

Answer: B) N-1

Explanation:

In order to join N tables, minimum number of join statements required is N-1.

Discuss this Question

24. ____ Clause is used in Parent-child relationship in order to join two or


more tables.

A. FROM
B. TO
C. WHERE
D. IN

Answer: C) WHERE

Explanation:

WHERE Clause is used in Parent-child relationship in order to join two or more


tables.

Discuss this Question

25. The Web SQL API is supported by –


A. Opera
B. Google Chrome
C. Android Browsers
D. All of the above

Answer: D) All of the above

Explanation:

The WEB SQL API is supported by Opera, Google Chrome and Android Browsers.

Discuss this Question

26. In order to manage or store the data in the database, WEB SQL Database
is used which is a –

A. Web site
B. Web page
C. Web browser
D. None of the above

Answer: B) Web page

Explanation:

In order to manage or store the data in the database, WEB SQL Database is used
which is a Webpage.

Discuss this Question

27. Which of the following statement is TRUE?

A. Web API is the part of HTML5


B. Web API is not the part of HTML5
C. Web API is the part of HTML
D. Web API is the part of XHTML
Answer: B) Web API is not the part of HTML5

Explanation:

Web API a separate specification and not the part of HTML5.

Discuss this Question

28. Select the correct method of Web SQL?

A. Execute SQL
B. Transaction
C. Open Database
D. All of the above

Answer: D) All of the above

Explanation:

Execute SQL, Transaction and Open Database are all the methods of Web SQL.

Discuss this Question

29. In order to execute a query in Web SQL, which function is used?

A. open()
B. translate()
C. transaction()
D. execute()

Answer: C) transaction()

Explanation:

In order to execute a query in Web SQL, db.transaction() is used.

Discuss this Question


30. Transaction is able to control the following –

A. Transaction
B. Commit
C. Rollback
D. All of the above

Answer: D) All of the above

Explanation:

Transaction is able to control transaction and rollback or commit.

1. GROUP BY clause is placed before which clause in SQL?

A. HAVING
B. WHERE
C. ORDER BY
D. FROM

Answer: C) ORDER BY

Explanation:

GROUP BY clause is placed before ORDER BY clause in SQL.

Discuss this Question

2. Which one if these is used to put the same value in all the rows?

A. Group by unique column


B. Group by single column
C. Group by one column
D. Group by same value

Answer: B) Group by single column


Explanation:

Group by single column is used to put the same value in all the rows.

Discuss this Question

3. In order to convert the expression from one to another data type, which
SQL Function is used?

A. CONVERT
B. CHANGE
C. CAST
D. TRANSIT

Answer: C) CAST

Explanation:

In order to convert the expression from one to another data type, SQL CAST
Function is used.

Discuss this Question

4. What is the syntax of SQL CAST Function?

A. CAST (expression AS [data type])


B. CAST (expression IN [data type])
C. CAST (expression TO [data type])
D. CAST (expression FOR [data type])

Answer: A) CAST (expression AS [data type])

Explanation:

CAST (expression AS [data type]) is the syntax of the SQL CAST function.

Discuss this Question


5. What is the default length of any data type in the CAST function?

A. 10
B. 20
C. 30
D. 40

Answer: C) 30

Explanation:

30 is the default length of any data type in the CAST function.

Discuss this Question

ADVERTISEMENT

6. Select the correct type(s) of SQL Comments.

A. Inline Comments
B. Single Line Comments
C. Multi-line Comments
D. All of the above

Answer: D) All of the above

Explanation:

Type of SQL Comments are Inline Comments, Single Line Comments and Multi-
line Comments.

Discuss this Question

7. Select the syntax of Single Line Comment.


A. .
B. !
C. --
D. #

Answer: C) --

Explanation:

"--" is the syntax of the Single Line Comment.

Discuss this Question

8. Comments whose starting and ending lines are different are known as –

A. Inline Comments
B. Multi-line Comments
C. Single Line Comments
D. Varied line Comments

Answer: B) Multi-line Comments

Explanation:

Comments whose starting and ending lines are different are known as Multi-line
Comments.

Discuss this Question

9. Select the correct syntax for Multi-line Comments.

A. //*Line1
B. Line2*//
C.
D. /*Line1
E. Line2/*
F.
G. */Line1
H. Line2*/
I.
J. /*Line1
K. Line2*/
L.

Answer: D)

/*Line1
Line2*/

Explanation:

The multi-line comment starts with /* and ends with */

Discuss this Question

10. What will be the output of the below SQL statement?

SELECT CAST(25.65 AS int);

A. 25
B. 26

Answer: A) 25

Explanation:

This statement converts the value to an int datatype.

Discuss this Question

11. What will be the output of the below SQL statement?


SELECT CAST(25.65 AS varchar);

A. 25
B. 26
C. 25.65
D. 25.00

Answer: C) 25.65

Explanation:

This statement converts the value to a varchar datatype.

Discuss this Question

12. What will be the output of the below SQL statement?

SELECT CAST('2021-10-06' AS datetime);

A. 2021-10-06 00:00:00.000
B. 2021-10-06
C. 2021 OCT 06
D. 06-10-2021

Answer: A) 2021-10-06 00:00:00.000

Explanation:

This statement converts the value to a datetime datatype.

1. Which of the following statement is TRUE about SQL Injection?

A. SQL Injection is an Object Penetration Technique


B. SQL Injection is a Function Penetration Technique
C. SQL Injection is a Code Penetration Technique
D. SQL Injection is a Database Penetration Technique

Answer: C) SQL Injection is a Code Penetration Technique


Explanation:

SQL Injection is a Code Penetration Technique and loss to our database could be
caused due to SQL Injection.

Discuss this Question

2. At which of the following stage does SQL Injection occurs?

A. When the user is asked to logout


B. When the user is asked to input password
C. When the user is asked to input captcha
D. When the user is asked to input username

Answer: D) When the user is asked to input username

Explanation:

SQL Injection occurs when the user is asked to input a username. In replacement
of the name or the user ID, a SQL statement is provided by the user.

Discuss this Question

3. Which of the following is the type of SQL Injection attack?

A. It inserts the data


B. It updates the data
C. It deletes the data
D. All of the above

Answer: D) All of the above

Explanation:
To insert, update and delete the data are all the types of SQL Injection attacks
and the attack can be used to modify the cookies to harm the database query of
the web application.

Discuss this Question

4. Which of the following is TRUE about the type of SQL Injection attack?

A. Install malicious program


B. Export valuable data
C. Get user login detail
D. All of the above

Answer: D) All of the above

Explanation:

Types of SQL Injection attack includes the installation of malicious program,


exporting of the valuable data and to get the user login details.

Discuss this Question

5. Select the correct statement which will return all the rows from the Table
and then also deletes the Table_Add table?

A. SELECT * FROM Table; DROP TABLE Table_Add


B. SELECT * WHERE Table; DROP TABLE Table_Add
C. SELECT * FROM Table; DELETE TABLE Table_Add
D. SELECT * WHERE Table; DELETE TABLE Table_Add

Answer: A) SELECT * FROM Table; DROP TABLE Table_Add

Explanation:
The correct statement which will return all the rows from the Table and then also
deletes the Table_Add table is – SELECT * FROM Table; DROP TABLE
Table_Add.

Discuss this Question

ADVERTISEMENT

6. Through which system, we can detect SQL Injection attacks?

A. Injection Detection System


B. Attack Detection System
C. Intrusion Detection System
D. None of the above

Answer: C) Intrusion Detection System

Explanation:

Through Intrusion Detection System, we can detect SQL Injection attacks.

Discuss this Question

7. Which of the following is TRUE about Intrusion Detection System?

A. Intrusion Detection System is Network-based


B. Intrusion Detection System is Host-based
C. Both A) and B)
D. None of the above

Answer: C) Both A) and B)

Explanation:

Intrusion Detection System is both Network-based and Host-based.

Discuss this Question


8. Network-based IDS can be used to monitor –

A. Web server logs


B. When something weird occurs
C. All connections to the database server
D. None of the above

Answer: C) All connections to the database server

Explanation:

Network-based IDS can be used to monitor all connections to the database


server and flags suspicious activities.

Discuss this Question

9. Host-based IDS can be used to monitor –

A. Web server logs


B. When something weird occurs
C. Both A) and B)
D. None of the above

Answer: C) Both A) and B)

Explanation:

Host-based IDS can be used to monitor the web server logs and when something
weird occurs.

Discuss this Question

10. How can we prevent SQL Injection attack?


A. We should pre-define the input type, input field and length of the user
data to validate the input for the user authentication.
B. Access privileges should be restricted for the users
C. Administrator accounts should not be used.
D. All of the above

Answer: D) All of the above

Explanation:

In order to prevent the SQL Injection attack, we should pre-define the input type,
input field, and length of the user data to validate the input for the user
authentication. Access privileges should be restricted for the users and
administrator accounts should not be used.

1. A Key which uniquely identifies each row in the table is known as?

A. Primary Key
B. Unique Key
C. Composite Key
D. Foreign Key

Answer: A) Primary Key

Explanation:

A Key which uniquely identifies each row in the table is known as Primary Key.

Discuss this Question

2. A Primary Key is basically a –

A. Row
B. Column
C. Table
D. Database

Answer: B) Column
Explanation:

A Primary Key is basically a Column or Columns.

Discuss this Question

3. If multiple columns are used as Primary Key, it is known as –

A. Unique
B. Composite
C. Foreign
D. None of the above

Answer: B) Composite

Explanation:

If multiple columns are used as Primary Key, it is known as Composite Key.

Discuss this Question

4. Which of the following statement is TRUE about Primary Key?

A. Table integrity is not enforced by the primary key.


B. The data in a primary key is always multiple.
C. 900 bytes is the maximum length of a primary key.
D. Null values are allowed in primary keys.

Answer: C) 900 bytes is the maximum length of a primary key

Explanation:

we can have up to 16 columns as primary key column and the total size of the
key columns should be less than or equal to 900 bytes.

Discuss this Question


5. Primary keys can be contained in a table only ____?

A. Once
B. Twice
C. Thrice
D. None of the above

Answer: A) Once

Explanation:

Primary keys can be contained in a table only once.

Discuss this Question

ADVERTISEMENT

6. To add a Primary Key constraint after table is created, which clause is


used?

A. UPDATE
B. ADD
C. ALTER
D. JOIN

Answer: C) ALTER

Explanation:

To add a Primary key constraint after table is created, ALTER clause is used.

Discuss this Question

7. In order to remove a primary key constraint, which clause is used?


A. DELETE
B. DROP
C. ALTER
D. REMOVE

Answer: B) DROP

Explanation:

In order to remove a primary key constraint, DROP clause is used.

Discuss this Question

8. In order to build a link between two tables, which key is used?

A. Primary
B. Foreign
C. Composite
D. Unique

Answer: B) Foreign

Explanation:

In order to build a link between two tables, foreign key is used.

Discuss this Question

9. Which of the following statement is FALSE?

A. A Primary Key cannot be NULL


B. A Foreign Key cannot be NULL
C. A Primary Key cannot be Duplicate
D. A Foreign Key can be Duplicate

Answer: B) A Foreign Key cannot be NULL


Explanation:

The option (B) is false, because a foreign key can be NULL or duplicate.

Discuss this Question

10. Foreign key is a field in a table that is _______ key in another table?

A. Primary
B. Unique
C. Composite
D. None of the above

Answer: A) Primary

Explanation:

Foreign key is a field in a table that is Primary Key in another table.

Discuss this Question

11. When two or more columns are combined to be used to uniquely


identify each row in the table, it is known as -

A. Primary Key
B. Unique Key
C. Composite Key
D. Foreign Key

Answer: C) Composite Key

Explanation:

When two or more columns are combined to be used to uniquely identify each
row in the table, it is known as Composite Key.

Discuss this Question


12. For one table, there can be ____unique key constraint(s).

A. 1
B. NULL
C. Many
D. None of the above

Answer: C) Many

Explanation:

For one table, there can be many unique key constraints.

Discuss this Question

13. All other columns other than the column which is termed as Primary
Key, are known as –

A. Unique Keys
B. Alternate Keys
C. Composite Keys
D. None of the above

Answer: B) Alternate Keys

Explanation:

All other columns other than the column which is termed as Primary Key, are
known as Alternate Keys.

1. Which of the following is among the 12 Codd's Rules?

A. View Updating Rule


B. Relational Level Operation Rule
C. Distribution Independence Rule
D. None of the above
Answer: A) View Updating Rule

Explanation:

Codd's 12 Rules are:

1. The Foundation Rule


2. Information Rule
3. Guaranteed Access Rule
4. Systematic Treatment of Null Values
5. Active/Dynamic Online Catalog based on the relational model
6. Comprehensive Data SubLanguage Rule
7. View Updating Rule
8. Relational Level Operation Rule
9. Physical Data Independence Rule
10. Logical Data Independence Rule
11. Integrity Independence Rule
12. Distribution Independence Rule
13. Non Subversion Rule

Discuss this Question

2. Which of the following is TRUE about The Foundation Rule in the 12


Codd's Rules?

A. Relational databases are required.


B. Databases contain a wide variety of information, and each row and column
of each table must hold this information.
C. The primary key value, table name, and column name are characteristics
that allow us to access the precise data (atomic value) logically from a
relational database.
D. Null values are treated in database records according to this rule.

Answer: A) Relational databases are required

Explanation:
Relational databases are required in The Foundation Rule of 12 Codd's Rules. By
using its relational capabilities, the system will be able to manage the database.

Discuss this Question

3. Which of the following is TRUE about Information Rule in the 12 Codd's


Rules?

A. The primary key value, table name, and column name are characteristics
that allow us to access the precise data (atomic value) logically from a
relational database.
B. Null values are treated in database records according to this rule.
C. Database systems must update all views tables on a regular basis.
D. Databases contain a wide variety of information, and each row and column
of each table must hold this information.

Answer: D) Databases contain a wide variety of information, and each row and
column of each table must hold this information

Explanation:

In case of Information Rule in the 12 Codd's Rules, Databases contain a wide


variety of information, and each row and column of each table must hold this
information.

Discuss this Question

4. In case of ____Rule, the primary key value, table name, and column name
are characteristics that allow us to access the precise data (atomic value)
logically from a relational database.

A. Systematic Treatment of Null Values


B. Guaranteed Access
C. View Updating
D. Physical Data Independence
Answer: B) Guaranteed Access

Explanation:

In case of Guaranteed Access Rule, the primary key value, table name, and
column name are characteristics that allow us to access the precise data (atomic
value) logically from a relational database.

Discuss this Question

5. What is the meaning of Null Values in Systematic Treatment of Null


Values in the 12 Codd's Rules?

A. No value in cell
B. Inappropriate Information
C. Unknown data
D. All of the above

Answer: D) All of the above

Explanation:

Null Values in Systematic Treatment of Null Values in the 12 Codd's Rules has
different meanings such as no value in the cell, missing the data, inappropriate
information, the primary key should not be null and unknown data.

Discuss this Question

ADVERTISEMENT

6. What is TRUE about the Active/Dynamic Online Catalog based on the


relational model in the 12 Codd's Rules?

A. The primary key value, table name, and column name are characteristics
that allow us to access the precise data (atomic value) logically from a
relational database.
B. Null values are treated in database records according to this rule.
C. Database dictionaries represent the complete logic of all descriptive data,
which must be stored online.
D. None of the above

Answer: C) Database dictionaries represent the complete logic of all descriptive


data, which must be stored online

Explanation:

In the case of Active/Dynamic Online Catalogue based on the relational model in


the 12 Codd's Rules, Database dictionaries represent the complete logic of all
descriptive data, which must be stored online.

Discuss this Question

7. Which of the following is supported in Comprehensive Data SubLanguage


Rule in the 12 Codd's Rules?

A. Data Definition
B. View Definition
C. Data Manipulation
D. All of the above

Answer: D) All of the above

Explanation:

Comprehensive Data SubLanguage Rule in the 12 Codd's Rules supports the


comprehensive, Data Definition, Data Manipulation, View Definition, Limit
Transaction Management Operations, and Integrity Constraints.

Discuss this Question

8. In the case of ____ Independence Rule, Physical independence of data to


access the database is a requirement for a database or an application.
A. Physical Data
B. Logical Data
C. Integrity
D. Distribution

Answer: A) Physical Data

Explanation:

In the case of the Physical Independence Rule, the Physical independence of data
to access the database is a requirement for a database or an application.

Discuss this Question

9. In the case of the ____ Independence Rule, It shouldn't make a difference


what the user sees (application) if the logical structure changes.

A. Physical Data
B. Logical Data
C. Integrity
D. Distribution

Answer: B) Logical Data

Explanation:

In the case of the Logical Data Independence Rule, It shouldn't make a difference
what the user sees (application) if the logical structure changes.

Discuss this Question

10. In the case of ____ Independence Rule, if using the SQL queries language
to insert data into table's cells, the database must maintain integrity
independence.

A. Interdependent
B. Intradependent
C. Integration
D. Integrity

Answer: D) Integrity

Explanation:

In the case of the Integrity Independence Rule, if using the SQL queries language
to insert data into table's cells, the database must maintain integrity
independence.

1. Select the correct statement about SQL Scripts?

A. At the run time, the SQL*Plus commands are ignored.


B. SQL Scripts and SQL Commands in the SQL Scripts have no interaction.
C. Through the SQL Script editor, SQL Commands are cut and pasted.
D. All of the above

Answer: D) All of the above

Explanation:

Explanation: Points to be noted about SQL Scripts are –

i. At the run time, the SQL*Plus commands are ignored.


ii. SQL Scripts and SQL Commands in the SQL Scripts have no interaction.
iii. Through the SQL Script editor, SQL Commands are cut and pasted.

Discuss this Question

2. _____ variables are not supported by SQL Script.

A. Bind
B. Dynamic
C. Both A) and B)
D. None of the above
Answer: C) Both A) and B)

Explanation:

Bind or Dynamic variables are not supported by SQL Script.

Discuss this Question

3. Name of the control in SQL Script –

A. Script
B. Owner
C. Opinion
D. All of the above

Answer: D) All of the above

Explanation:

Name of the controls in SQL Script are Script, Owner and Opinion.

Discuss this Question

4. In the script field, script is found by entering the –

A. Script Name
B. Script Number
C. Script ID
D. Script Symbol

Answer: A) Script Name

Explanation:

In the script field, script is finding by entering the partial name or script name.

Discuss this Question


5. The description in SQL Script, displays script in –

A. One Line
B. Two Line
C. Three Line
D. Many Lines

Answer: A) One Line

Explanation:

The description in SQL Script, displays the script in One Line.

Discuss this Question

ADVERTISEMENT

6. Description allows the Script to load the –

A. Owner of the script


B. Script name
C. Script Editor
D. All of the above

Answer: D) All of the above

Explanation:

Description allows the Script to load the owner of the script, script name and
script editor.

Discuss this Question

7. What does task list consist of in SQL Script?


A. Import
B. Show Quotas
C. Manage Results
D. All of the above

Answer: D) All of the above

Explanation:

Task list consist of Import, Export, Show Quotas and Manage Results in SQL
Script.

Discuss this Question

8. The ____ size of the result is shown by Script Quota.

A. Minimum
B. Maximum
C. Average
D. None of the above

Answer: B) Maximum

Explanation:

The maximum size of the result is shown by Script Quota.

Discuss this Question

9. What is Export Script by default?

A. Workspace_name_size/sql
B. Workspace_number_script/sql
C. Workspace_name_script/sql
D. Workspace_name_script/spl
Answer: C) Workspace_name_script/sql

Explanation:

Export script is by default "Workspace_name_script/sql/".

Discuss this Question

10. What is the shortcut key to open SQL Script?

A. Ctrl+Shift+S
B. Ctrl+Shift+Q
C. Ctrl+Shift+N
D. Ctrl+Shift+O

Answer: D) Ctrl+Shift+O

Explanation:

Shortcut key to open SQL Script Ctrl+Shift+O.

Discuss this Question

ADVERTISEMENT

11. In order to delete the Script in the Script Editor, the following steps need
to be followed:

i. In the Script Editor, select the script to be deleted.


ii. Go to the workspace home page and select SQL Workshop, then SQL
Scripts. On the screen, you will see the SQL Scripts page.
iii. Remove the script from the Script Repository by clicking the Delete button.
Prior to the deletion of the script, we are required to confirm our action.

Options:

A. iii > i > ii


B. iii > ii > i
C. ii > i > iii
D. i > ii > iii

Answer: C) ii > i > iii

Explanation:

The correct order in which the steps need to be followed in order to delete the
script in the script editor is as follows:

i. Go to the workspace home page and select SQL Workshop, then SQL
Scripts. On the screen, you will see the SQL Scripts page.
ii. In the Script Editor, select the script to be deleted.
iii. Remove the script from the Script Repository by clicking the Delete button.
Prior to the deletion of the script, we are required to confirm our action.

Discuss this Question

12. Scripts ____ from various workspaces can be imported through import.

A. Exported
B. Imported
C. Changed
D. Saved

Answer: A) Exported

Explanation:

Scripts exported from various workspaces can be imported through import.

Discuss this Question

13. With export, you can ____ SQL Scripts from the SQL repositories in your
workspace.
A. Export
B. Import
C. Save
D. Exchange

Answer: B) Import

Explanation:

With export, you can import SQL Scripts from the SQL repositories in your
workspace.

1. Output returned by the Scalar functions is/are -

A. Single Value
B. Multiple Value
C. Two Values
D. None of the above

Answer: A) Single Value

Explanation:

The output returned by the Scalar functions is Single Value.

Discuss this Question

2. The scalar functions operate on each record ____ in SQL.

A. Dependently
B. Independently
C. Interdependently
D. Intradependently

Answer: B) Independently

Explanation:
The scalar functions operate on each record independently in SQL.

Discuss this Question

3. Which of the following is/are Scalar function(s)?

A. UCASE()
B. MID()
C. ROUND()
D. All of the above

Answer: D) All of the above

Explanation:

The commonly used Scalar functions are -

• UCASE()
• MID()
• ROUND()
• FORMAT()
• LCASE()
• LENGTH()
• NOW()

Discuss this Question

4. What is the functionality of UCASE function?

A. To change the case of the string to lowercase characters.


B. To change the case of the string to uppercase characters.
C. To change the case of the string to numeric characters.
D. To change the case of the string to symbolic characters.

Answer: B) To change the case of the string to uppercase characters


Explanation:

UCASE function is used to change the case of the string to uppercase characters.

Discuss this Question

5. Full form of LCASE is -

A. Low case
B. Letter case
C. Light case
D. Lower case

Answer: D) Lower case

Explanation:

Full form of LCASE is Lower case.

Discuss this Question

ADVERTISEMENT

6. Which function is used to extract substrings from the column of the table

A. ROUND()
B. MID()
C. FORMAT()
D. NOW()

Answer: B) MID()

Explanation:

The MID() function is used to extract substrings from the column of the table.
Discuss this Question

7. NOW function is used to return the current –

A. Time
B. Date
C. Date & Time
D. Day

Answer: C) Date & Time

Explanation:

NOW function is used to return the current Date & Time of the system.

Discuss this Question

8. In order to format, how the column should be displayed, which function


is used?

A. FORM()
B. DISPLAY()
C. COL()
D. FORMAT()

Answer: D) FORMAT()

Explanation:

In order to format, how the column should be displayed, the FORMAT function is
used.

Discuss this Question

9. ROUND function consists of ___ parameters?


A. One
B. Two
C. Three
D. Four

Answer: B) Two

Explanation:

The ROUND() function consists of Two Parameters and is used with


the SELECT query in order to print the formatted value.

Discuss this Question

10. Choose the correct syntax of NOW function?

A. SELECT ()NOW;
B. NOW() SELECT;
C. SELECT NOW();
D. SELECT OWN();

Answer: C) SELECT NOW();

Explanation:

SELECT NOW(); is the correct syntax of NOW function.

You might also like