!
ISM LAB QUIZ (April 2022)
ISM LAB QUIZ (April 2022)
1)
P1. The USE command Mark
: 1.00
Has been deprecated and should be
avoided for security reasons
Should be used to choose the
database you want to use once
you’ve connected to MySQL
Is used to load code from another file
Is a pseudonym for the SELECT
command
2) P2. Which of these is not a valid
name for a column
Mark
: 1.00
To
From
Far
Near
3) P3. Commands passed to the
MySQL daemon are written in
Mark
: 1.00
English
Your choice from Perl, PHP, Java or
some other languages
the Structured Query Language
Swedish
4) P4. Which of the following is
available in MySQL:
Mark
: 1.00
CREATE TRIGGER
CREATE SCHEMA
CREATE DATABASE
CREATE VIEW
5) P5. How many Primary keys can
have in a table?
Mark
: 1.00
Only 1
Only 2
Depends on number of Columns
Depends on DBA
6) P6. Which operator is used to
compare a value to a specified
list of values while using check
constraint?
Mark
: 1.00
ANY
BETWEEN
IN
ALL
7) P7. If we have not specified ASC or
DESC after a MySQL / SQL ORDER
BY clause, the following is used
by default
Mark
: 1.00
DESC
ASC
There is no default value
None of the mentioned
8) P8. Which of the following is true
about the HAVING clause?
Mark
: 1.00
Similar to the WHERE clause but is
used for columns rather than groups.
Similar to WHERE clause but is used
for rows rather than columns.
Similar to WHERE clause but is used
for groups rather than rows.
Acts exactly like a WHERE clause.
9) P9. How can you change
"Thomas" into "Michel" in the
"LastName" column in the Users
table?
Mark
: 1.00
UPDATE User SET LastName =
'Thomas' INTO LastName = 'Michel';
MODIFY Users SET LastName =
'Michel' WHERE LastName = 'Thomas';
MODIFY Users SET LastName =
'Thomas' INTO LastName = 'Michel';
UPDATE Users SET LastName =
'Michel' WHERE LastName = 'Thomas';
10) P10. Which command is used to
change the definition of a table in
MySQL / SQL?
Mark
: 1.00
CREATE
UPDATE
ALTER
SELECT
11) P11. Which of the following is the
correct order of a MySQL / SQL
statement?
Mark
: 1.00
SELECT, GROUP BY, WHERE, HAVING
SELECT, WHERE, GROUP BY, HAVING
SELECT, HAVING, WHERE, GROUP BY
SELECT, WHERE, HAVING, GROUP BY
12) P12. What is the difference
between a PRIMARY KEY and a
UNIQUE KEY?
Mark
: 1.00
Primary key can store null value,
whereas a unique key cannot store
null value.
We can have only one primary key in
a table while we can have multiple
unique keys.
Primary key cannot be a date
variable whereas unique key can be.
None of these.
13) P13. Which operator is used to
compare the NULL values in
MySQL / SQL?
Mark
: 1.00
Equal
IN
IS
None of the above
14) P14. 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.
Mark
: 1.00
I and III
II and III
II and IV
II and IV
15) P15. Find the cities name with the
condition and temperature from
table 'whether' where condition =
sunny or cloudy but temperature
>= 60.
Mark
: 1.00
SELECT city, temperature, condition
FROM weather WHERE condition =
'cloudy' AND condition = 'sunny' OR
temperature >= 60;
SELECT city, temperature, condition
FROM weather WHERE condition =
'cloudy' OR condition = 'sunny' OR
temperature >= 60;
SELECT city, temperature, condition
FROM weather WHERE condition =
'sunny' OR condition = 'cloudy' AND
temperature >= 60;
SELECT city, temperature, condition
FROM weather WHERE condition =
'sunny' AND condition = 'cloudy' AND
temperature >= 60;
16) P16. 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?
Mark
: 1.00
SELECT * FROM weather WHERE
humidity IN (60 to 75);
SELECT * FROM weather WHERE
humidity BETWEEN 60 AND 75;
SELECT * FROM weather WHERE
humidity NOT IN (60 AND 75);
SELECT * FROM weather WHERE
humidity NOT BETWEEN 60 AND 75;
17) P17. Which statement is used to
get all data from the student
table whose name starts with p?
Mark
: 1.00
SELECT * FROM student WHERE name
LIKE '%p%';
SELECT * FROM student WHERE name
LIKE 'p%';
SELECT * FROM student WHERE name
LIKE '_p%';
SELECT * FROM student WHERE name
LIKE '%p';
18) P18. _______ is a constraint
that can be defined only at the
column level?
Mark
: 1.00
UNIQUE
NOT NULL
CHECK
PRIMARY KEY
19) P19. Which clause is used to sort
query elements?
Mark
: 1.00
GROUP
GROUP BY
ORDER
ORDER BY
21) P20. The number of attributes /
fields in the following MySQL / SQL
table is ______________
CREATE TABLE employee (
emp_name CHAR(30),
emp_id INT
);
Mark
: 1.00
30
22) P21. In the following MySQL
command how many rows will be
deleted?
DELETE person WHERE person_id=1;
/*person_id is a primary key */
Mark
: 1.00
All
None
23) P22. If you want to undo a GRANT,
you should use
Mark
: 1.00
REVOKE
UNDO
UNGRANT
WITHDRAW
24) P23. To remove duplicate rows
from the result set of a SELECT use
the following keyword:
Mark
: 1.00
NO DUPLICATE
UNIQUE
DISTINCT
None of the above
25) P24. Primary Key does allow the
Null Values. where as in Unique
key doesn’t accept the Null
values.
Mark
: 1.00
True
False
26) P25. In a SELECT with a GROUP BY
clause, a WHERE clause, and a
HAVING clause, the WHERE
conditions are applied before the
HAVING conditions.
Mark
: 1.00
True
False
27) P26. In order to add a new column
to an existing table in MySQL /
SQL, we can use the command
Mark
: 1.00
MODIFY TABLE
EDIT TABLE
ALTER TABLE
ALTER COLUMNS
28) P27. Which clause is used to
arrange the result of SELECT
statement in particular order?
Mark
: 1.00
ORDER BY
SORT BY
ARRANGE BY
None of the above
29) P28. Which statement is used to
count number of rows in table?
Mark
: 1.00
SELECT COUNT(*) FROM table_name;
SELECT COUNT ALL(*) FROM
table_name;
SELECT ROWS(*) FROM table_name;
All of the above
30) P29. In a LIKE clause, you can
could ask for any value ending in
“ton” by writing?
Mark
: 1.00
LIKE ton$
LIKE ^.*ton$
LIKE %ton
LIKE .*ton
31) P30. How much character are
allowed to create database
name?
Mark
: 1.00
55
72
64
40
32) P31. In MySQL / SQL, which of the
following is not a data definition
language commands?
Mark
: 1.00
RENAME
ALTER
DROP
UPDATE
33) P32. To delete a particular
column in a relation the
command used is:
Mark
: 1.00
UPDATE TABLE
TRUNCATE COLUMN
ALTER , DROP
DELETE COLUMN
34) P33. DCL provides commands to
perform actions like
Mark
: 1.00
Change the structure of Tables
Insert, Update or Delete Records and
Values
Authorizing Access and other control
over Database
None of Above
35) P34. Which of the following is a
correct expression in MySQL /
SQL?
Mark
: 1.00
SELECT NULL FROM SALES;
SELECT NAME FROM SALES;
SELECT * FROM SALES WHEN PRICE =
NULL;
SELECT # FROM SALES;
36) P35. Which of the following
statement is true?
Mark
: 1.00
DELETE does not free the space
containing the table and TRUNCATE
free the space containing the table
Both DELETE and TRUNCATE free the
space containing the table
Both DELETE and TRUNCATE does not
free the space containing the table
DELETE free the space containing the
table and TRUNCATE does not free
the space containing the table
37) P36. In MySQL / SQL SELECT
statement querying a single
table, according to the MySQL /
SQL standard the asterisk (*)
means that:
Mark
: 1.00
all columns of the table are to be
returned.
all records meeting the full criteria
are to be returned.
all records with even partial criteria
met are to be returned.
None of the above is correct.
38) P37. The result of a MySQL / SQL
SELECT statement is a ______.
Mark
: 1.00
file
report
table
form
39) P38. Table Employee has 10
records. It has a non-NULL
SALARY column which is also
UNIQUE. The MySQL / SQL
statement
SELECT COUNT(*) FROM Employee WHERE SALARY
Returns ???
Mark
: 1.00
10
0
40) P39. Which of the SQL statements
is correct?
Mark
: 1.00
SELECT Username AND Password
FROM Users;
SELECT Username, Password FROM
Users;
SELECT Username, Password WHERE
Username = ‘user1’;
None of these
41) P40. The FROM SQL clause is used
to…
Mark
: 1.00
specify what table we are selecting
or deleting data FROM
specify range for search condition
specify search condition
None of these
42) P41. Which MySQL / SQL keyword
is used to retrieve a maximum
value?
Mark
: 1.00
TOP
MOST
UPPER
MAX
43) P42. Which operator performs
pattern matching?
Mark
: 1.00
BETWEEN operator
LIKE operator
EXISTS operator
EXISTS operator
44) P43. What operator tests column
for the absence of data?
Mark
: 1.00
EXISTS operator
NOT operator
IS NULL operator
None of these
45) P44. In MySQL / SQL, which
command(s) is(are) used to
change a table’s storage
characteristics?
Mark
: 1.00
ALTER TABLE
MODIFY TABLE
CHANGE TABLE
All of the above
46) P45. Consider the following
schema / table structure −
STUDENTS(student_code, first_name, last_na
Which of the following query
would display all the students
where the second letter in the
first name is ‘i’?
Mark
: 1.00
select first_name from students
where first_name like ‘_i%’;
select first_name from students
where first_name like ‘%i_’;
select first_name from students
where first_name like ‘%i%’;
select first_name from students
where first_name like ‘_i_’;
47) P46. Consider the following
schema / table structure −
HONOURS_SUBJECT(subject_code, subject_name
LOCATIONS(subject_code, department_name, l
Select the right query for
retrieving records from the tables
HONOURS_SUBJECT and
LOCATIONS with a full outer join
Mark
: 1.00
select h.subject_name,
l.department_name,
h.department_head, l.city from
honours_subject h full outer join
location l on(h.subject_code =
l.subject_code);
select h.subject_name,
l.department_name,
h.department_head, l.city from
honours_subject h full outer join
location l on(subject_code);
select h.subject_name,
l.department_name,
h.department_head, l.city from
honours_subject h full outer join
location l where (h.subject_code =
l.subject_code);
None of the above.
48) P47. Which of the following is not
true about a FOREIGN KEY
constraint?
Mark
: 1.00
It is a referential integrity constraint.
It establishes a relationship between
a primary key or a unique key in the
same table or a different table.
A foreign key value cannot be null.
A foreign key value must match an
existing value in the parent table.
49) P48.
Table A
Id Name Age
----------------
12 Arun 60
15 Shreya 24
99 Rohit 11
Table B
Id Name Age
----------------
15 Shreya 24
25 Hari 40
98 Rohit 20
99 Rohit 11
Table C
Id Phone Area
-----------------
10 2200 02
99 2100 01
Consider the above tables A, B
and C. How many tuples does the
result of the following SQL query
contains?
SELECT A.id
FROM A
WHERE A.age > ALL (SELECT B.age
FROM B
WHERE B. name = "arun
Mark
: 1.00
50) P49. A relational schema for a
train reservation database is
given below. Passenger (pid,
pname, age) Reservation (pid,
class, tid)
Table: Passenger
pid pname age
-----------------
0 Sachin 65
1 Rahul 66
2 Sourav 67
3 Anil 69
Table : Reservation
pid class tid
---------------
0 AC 8200
1 AC 8201
2 SC 8201
5 AC 8203
1 SC 8204
3 AC 8202
What pids are returned by the
following SQL query for the above
instance of the tables?
SLECT pid
FROM Reservation ,
WHERE class ‘AC’ AND
EXISTS (SELECT *
FROM Passenger
WHERE age > 65 AND
Passenger. pid = Reservation.pid)
Mark
: 1.00
1, 0
1, 2
1, 3
1, 5
51) P50. Consider the following
relational schema:
Suppliers(sid:integer, sname:string, city:s
Parts(pid:integer, pname:string, color:stri
Catalog(sid:integer, pid:integer, cost:real
Consider the following relational
query on the above database:
SELECT S.sname
FROM Suppliers S
WHERE S.sid NOT IN (SELECT C.sid
FROM Catalog C
WHERE C.pid NOT
Mark
: 1.00
Find the names of all suppliers who
have supplied a non-blue part.
Find the names of all suppliers who
have not supplied a non-blue part.
Find the names of all suppliers who
have supplied only blue parts.
Find the names of all suppliers who
have not supplied only blue parts.
52) P51. Consider the table
employee(empId, name,
department, salary) and the two
queries Q1 ,Q2 below. Assuming
that department 5 has more than
one employee, and we want to
find the employees who get
higher salary than anyone in the
department 5, which one of the
statements is TRUE for any
arbitrary employee table?
Q1 : Select e.empId
From employee e
Where not exists
(Select * From employee s where s.
s.
Q2 : Select e.empId
From employee e
Where e.salary > Any
(Select distinct salary From employee
Mark
: 1.00
Q1 is the correct query
Q2 is the correct query
Both Q1 and Q2 produce the same
answer.
Neither Q1 nor Q2 is the correct query
53) P52. Which of the following is not
a built in aggregate function in
SQL?
Mark
: 1.00
Avg
Total
Max
Count
54) P53. Observe the given SQL query
and choose the correct option.
SELECT branch_name, COUNT (DISTINCT custom
FROM depositor, account
WHERE depositor.account_number = account.a
GROUP BY branch_id
Mark
: 1.00
The query is syntactically correct but
gives the wrong answer
The query is syntactically wrong
The query is syntactically correct
and gives the correct answer
The query contains one or more
wrongly named clauses.
55) P54. We apply the aggregate
function to a group of sets of
tuples using the _______
clause.
Mark
: 1.00
group by
group
group set
group attribute
56) P55. Choose the correct option
regarding the query
SELECT branch_name, COUNT (DISTINCT custom
FROM depositor, account
WHERE depositor.account_number = account.a
GROUP BY branch_id
HAVING avg(balance) = 10000;
Mark
: 1.00
The having clause checks whether
the query result is true or not
The having clause does not check
for any condition
The having clause allows only those
tuples that have average balance
10000
None of the mentioned
57) P56. What values does the count
(*) function ignore?
Mark
: 1.00
Repetitive values
Null values
Characters
Integers
58) P57. Observe the following query
and choose the correct option
SELECT DISTINCT name
FROM student
WHERE ID IS NOT NULL;
Mark
: 1.00
The query is syntactically wrong
The query gives all the possible
student names where a finite value
exists for ID
The query gives the names of the
students that have a null ID and it
also excludes identical names
The query gives the student names
where a finite value exists for ID and
it excludes identical names
59) P58. What is a subquery?
Mark
: 1.00
A subquery is a select-from-where
expression that is nested within
another query
A subquery is any query that is
nested within another query
A subquery is a relation that is
externally specified which can be
used to handle data in queries
A subquery is a condition that
excludes all the invalid tuples from
the database
60) P59. What is the result of the
following query?
SELECT studname
FROM college
WHERE marks > SOME (SELECT marks
FROM student
WHERE SECTION =
Mark
: 1.00
The query gives all the studnames
for which marks are greater than all
the students in section c
The query gives all the studnames
for which the marks are greater than
at least on student in section c
The query gives all the studnames
for which the marks are less than all
the students in section c
The query is syntactically incorrect
61) P60. Choose the correct option
regarding the following query
INSERT INTO course ('CS-67' , 'course name'
Mark
: 1.00
Data is inserted into the course
relation
Data is not inserted into the course
relation due to incorrect specification
Data is inserted into the CS-67
relation
Data is not inserted due to the
incorrect use of syntax
62) P61. To combine multiple
retrievals, we write several
SELECT statements and put the
keyword between them. What is
the keyword?
Mark
: 1.00
COMBINE
CONCAT
JOIN
UNION
79) P62. What is xyz in the following
MySQL / SQL statement? SELECT
xyz FROM table1 UNION xyz FROM
table2;
Mark
: 1.00
row name
column name
table name
database name
64) P63. Which keyword used with
UNION does not retain duplicate
rows?
Mark
: 1.00
ALL
NARROW
STRICT
DISTINCT
65) P64. SELECT on a MERGE table is
like _____________
Mark
: 1.00
UNION ALL
UNION
UNION DISTINCT
JOIN
66) P65. Which one is correct syntax
for applying UNION operator?
Mark
: 1.00
SELECT column_name(s) FROM
table_name1 UNION table_name2;
SELECT column_name(s) FROM
table_name1 UNION SELECT
column_name(s) FROM
table_name2;
UNION SELECT column_name(s)
FROM table_name1 SELECT
column_name(s) FROM
table_name2;
SELECT FROM table_name1 AND
table_name2;
67) P66. Which of the following
statement(s) is/are True about
UNION?
Mark
: 1.00
Data Types in all queries in a UNION
must match position wise
Column Names in all queries in a
UNION must match position wise
UNION can be used with UPDATE
statement
None of the above
68) P67. How many join types in join
condition:
Mark
: 1.00
69) P68. The following statement is
invalid.
SELECT name, id FROM table1 UNION name, de
Mark
: 1.00
False
True
70) P69. What is ‘name’ in the
following statement?
SELECT name FROM table1 UNION name FROM ta
Mark
: 1.00
database name
table name
column name
row name
71) P70. To combine multiple
retrievals, we write several
SELECT statements and put the
keyword between them. What is
the keyword?
Mark
: 1.00
JOIN
COMBINE
UNION
CONCAT
72) P71. Which statement is used to
select a default database?
Mark
: 1.00
DROP
USE
SCHEMA
CREATE
73) P72. What data type is used for
variable CHARACTER SET?
Mark
: 1.00
char()
Varchar()
float
int
74) P73. Which keyword is used to
specify the foreign key after the
table is created?
Mark
: 1.00
SPECIFY
ALTER TABLE
SETUP
SET
75) P74. Which clause is used to
remove a foreign key constraint?
Mark
: 1.00
EXCLUDE
DROP
DELETE
REMOVE
80) P75. Which clause is used to
remove a Unique key constraint?
Mark
: 1.00
EXCLUDE
DROP
DELETE
REMOVE
77) P76. Which clause names the
parent table and the index
columns in the table?
Mark
: 1.00
ON DELETE
FOREIGN KEY
REFERENCES
CONSTRAINT
78) P77. The property that enforces
foreign key relationships stay
intact is called
Mark
: 1.00
referential integrity
consistency
durability
atomicity
81) P78. Foreign keys cannot handle
deletes and updates.
Mark
: 1.00
True
False
82) P79. Which key declares that an
index in one table is related to
that in another?
Mark
: 1.00
cross
primary
secondary
foreign
83) P80. The wildcard in a WHERE
clause is useful when?
Mark
: 1.00
An exact match is necessary in a
CREATE statement.
An exact match is necessary in a
SELECT statement.
An exact match is not possible in a
SELECT statement.
n exact match is not possible in a
CREATE statement.
84) P81. The command to eliminate a
table from a database is:
Mark
: 1.00
DROP TABLE CUSTOMER;
DELETE TABLE CUSTOMER;
REMOVE TABLE CUSTOMER;
UPDATE TABLE CUSTOMER;
85) P82. The SQL keyword(s)
________ is used with
wildcards
Mark
: 1.00
NOT IN only
LIKE only
IN only
IN and NOT IN
86) P83. The different classes of
relations created by the
technique for preventing
modification anomalies are
called:
Mark
: 1.00
normal forms.
referential integrity constraints.
functional dependencies.
None of the above is correct.
87) P84. Row is synonymous with the
term:
Mark
: 1.00
record.
relation.
column.
field.
88) P85. The primary key is selected
from the:
Mark
: 1.00
Composite key
Candidate key
Foreign key
Alternate Key
89) P86. A Foreign key is combined
with a foreign key creates
Mark
: 1.00
Parent child relationship between
the tables that connect them
Many-Many relationship between
the tables that connect them
Network model between the tables
that connect them
None of the Mentioned
90) P87. In a database, a foreign key
is ?
Mark
: 1.00
A data element/attribute within a
data field of a data record that is not
unique, and cannot be used to
distinguish one data record in a
database from another data record
within a database table
A data element/attribute within a
data field of a data record within a
database table that is a secondary
key in another database table
A data element/attribute within a
data field of a data record within a
database table that is a primary key
in another database table
A data element/attribute within a
data field of a data record that
enables a database to uniquely
distinguish one data record in a
database from another data record
within a database table
91) P88. A Key which is a set of one or
more columns that can identify a
record uniquely is called?
Mark
: 1.00
Natural key
Candidate key
Not Null key
Alternate key
92) P89. What is a candidate key?
Mark
: 1.00
Used to uniquely identify a row
Alias for primary key
Used to identify a column
Alias for foreign key
93) P90. Which Of These Commands
Will Delete A Table Called XXX If
You Have Appropriate Authority?
Mark
: 1.00
DROP XXX;
DROP TABLE XXX;
DROP XXX WHERE Confirm = "YES";
DELETE XXX WHERE Confirm = "YES";
94) P91. On executing DELETE
command, if you get an error
“foreign key constraint” – what
does it imply?
Mark
: 1.00
Foreign key not defined
Table is empty
Connectivity issue
Data is present in the other table
95) P92. Can I define multiple unique
constraints on a table?
Mark
: 1.00
Yes
No
96) P93. When do we use a HAVING
clause?
Mark
: 1.00
To limit the output of a query
To limit the output of a query using
an aggregate function only
When GROUP by is used
Both a and c above
97) P94. What is the difference
between the WHERE and HAVING
MySQL / SQL clauses?
Mark
: 1.00
The WHERE and the HAVING clauses
are identical The HAVING SQL clause
condition(s) is applied to all rows in
the result set before the
WHERE clause is applied (if parent).
The WHERE clause is used only with
SELECT SQL statements and specifies
a search condition for an aggregate
or a group.
HAVING clause is applied (if parent).
The HAVING clause is used only with
SELECT SQL statements and specifies
a search condition for an aggregate
or a group
All of the above
98) P95. In the following query, what
does “person_id” stands for?
CREATE TABLE person (person_
id INT, fname VARCHAR(20),
lname VARCHAR(20));
Mark
: 1.00
Normal attribute of the table
Composite key
Primary key
Candidate Key
99) P96. In the following query
“person_id” can be SELECT
person_id, fname,l name,
Birth_data FROM person WHERE
person_id=1;
Mark
: 1.00
Key attribute
only Attribute
Both
None
100) P97. Which command is used for
the table definition in Mysql /
SQL?
Mark
: 1.00
DESC table_name;
DESC
None
Both
101) P98. Which command is used on
Mysql command line tool to
return to window command
shell?
Mark
: 1.00
exit
exit;
exit()
exit();
102) P99. Which clause is used with an
“aggregate functions”?
Mark
: 1.00
GROUP BY
SELECT
WHERE
Both 1 and 3
103) P100. What will be the output of
the query given below? SELECT
emp_id, fname, lname FROM
employee WHERE title=’HEAD
TELLER’ AND start_date=2008-11-
24;
Mark
: 1.00
All columns
Only those columns which are
mention with “SELECT” clause
Columns mention with “SELECT”
clause and only those rows which
contain ‘HEAD TELLER’ as a “title” and
start_date as 2008-11-24
None of the mentioned
DRAFT SUBMIT
!