Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
119 views17 pages

SQL Command Quiz Questions

Uploaded by

chinnapapu751
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views17 pages

SQL Command Quiz Questions

Uploaded by

chinnapapu751
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1 Fill in the blank:

________ command is used to change table structure in SQL.


(A) update (B) change (C) alter (D) modify

2 Which of the following commands will remove the entire database from MYSQL?
(A) DELETE DATABASE (B) DROP DATABASE
(C) REMOVE DATABASE (D) ALTER DATABASE

3 Fill in the blank:


_____ is a non-key attribute, whose values are derived from the primary key of some
other table.
(A) Primary Key (B) Candidate Key (C) Foreign Key (D) Alternate Key

4 Fill in the blank:


The SELECT statement when combined with ________ clause, returns records without
repetition.
(A) DISTINCT (B) DESCRIBE (C) UNIQUE (D) NULL

5 Which function is used to display the total number of records from a table in a database?
(A) total() (B) total(*) (C) return(*) (D) count(*)

6 Which of the following statements is True?


a) There can be only one Foreign Key in a table.
b) There can be only one Unique key is a table
c) There can be only one Primary Key in a Table
d) A table must have a Primary Key.

7 Which of the following is not part of a DDL query?


a) DROP b) MODIFY c) DISTINCT d) ADD

8 _______________ Keyword is used to obtain unique values in a SELECT query


a) UNIQUE b) DISTINCT c) SET d) HAVING

9 Which statement in MySql will display all the tables in a database?


a) SELECT * FROM TABLES; b) USE TABLES;
c) DESCRIBE TABLES; d) SHOW TABLES;

10 Which of the following is a valid sql statement?


a) ALTER TABLE student SET rollno INT(5);
b) UPDATE TABLE student MODIFY age = age + 10;
c) DROP FROM TABLE student;
d) DELETE FROM student;

11 ______ command is used to remove a column from a table in SQL.


(a) update (b)remove (c) alter (d)drop

12 Which of the following commands will delete the rows of table?


(a) DELETE command (b) DROP Command
(c) REMOVE Command (d) ALTER Command

13 Logical Operators used in SQL are?


(a) AND,OR,NOT (b) &&,||,! (c) $,|,! (d) None of these

14 All tuples in the relation are assigned NULL as the value for the new Attribute,with the
________Command
(a) MODIFY (b) TAILOR (c)ELIMINATE (d) ALTER

15 Which of the following ignores the NULL values inSQL?


a) Count(*) b) count() c)total(*) d)None of these

16 Which of the following is not a legal method for fetching records from a database from
within a Python program?
(a) fetchone() b)fetchtwo() (c) fetchall() (d) fetchmany()

17 Which of the following commands will be used to select a particular database


named "Student" from MY SQL Database?
(a) SELECTStudent; (b)DESCRIBE Student:
(c) USE Student; (d) CONNECT Student;

18 An attribute in a relation is a foreign key if it is the ________ key in any other relation.
(a) Primary Key (b) Foreign Key (c) Candidate Key (d) Unique Key_

19 When two conditions must both be true for the rows to be selected, the conditions are
separated by the SQL keyword
(a)ALL (b) IN (c) AND (d)OR

20 The statement which is used to get the number of rows fetched by execute( ) method of
cursor:
(a) [Link]( ) (b) [Link]()
(c) [Link]( ) (d) [Link]( )

21 ______ command is used to ADD a column in a table in SQL.


(a) update (b)remove (c) alter (d)drop

22 Which of the following is a DML command?


(a) CREATE (b) ALTER (c) INSERT (d) DROP

23 _________ is a non-key attribute, whose values are derived from the primary key of
some other table.
(a) Foreign Key (b) Primary Key (c) Candidate Key (d) Alternate Key

24 Which SQL keyword is used to retrieve only unique values?


(a) DISTINCTIVE (b) UNIQUE (c) DISTINCT (d) DIFFERENT

25 Which function is used to display the total number of records from a table in a
database?
(a) sum(*) (b) total(*) (c) count(*) (d) return(*)

26 Which of the following function is used to established connection between Python and
MySQL database?
(a) connection() (b) connect() (c) Connect() (d) None
27 ____________command is used to delete the table from the database of SQL.
(a) update (b)remove (c) alter (d) drop

28 Which of the following commands will use to change the structure of table in
MYSQL database?
(a)DELETE TABLE (b)DROP TABLE
(c)REMOVE TABLE (d)ALTER TABLE

29 __________is an attribute whose value is derived from the primary key of some other
table.
(a) Primary Key (b) Foreign Key (c) Candidate Key (d) Alternate Key

30 The SELECT statement when combined with_________function,returns number of rows


present in the table.
(a) DISTINCT (b) UNIQUE (c) COUNT (d) AVG

31 Which function is used to display the unique values of a column of a table?


(a) sum() (b) unique() (c)distinct() (d)return()

32 To establish a connection between Python and SQL database, connect() is used. Which of
the following value can be given to the keyword argument –host, while calling connect ()?
(a) localhost (b) [Link] (c) any one of (a) or (b) (d) localmachine

33 Name DDL commands from the following.


a) drop b)select c)insert d)update

34 What is the default date format of Mysql.


a)’ dd-mm-yy’ b)’ d-m-y‘ c)‘ yyyy-mm-dd’ d)None

35 Write command to view table structure.

36 Name any two RDBMS software.

37 ______ command is used to remove a column from a table in SQL.


a) update b) remove c) alter d)drop

38 Which of the following commands will delete a table from a MYSQL database?
a) DELETE b) DROP c) REMOVE d) ALTER

39 An alternate key is a , which is not the primary key of the table.


a) Primary Key b) Foreign Key c) Candidate Key d) Alternate Key

40 Select the correct statement, with reference to RDBMS:


a) NULL can be a value in a Primary Key column
b) '' (Empty string) can be a value in a Primary Key column
c) A table with a Primary Key column cannot have an alternate key.
d) A table with a Primary Key column must have an alternate key.

41 Which function cannot be used with string type data?


a) min() b) max() c) count() d) sum()

42 In context of Python - Database connectivity, the function fetchmany()is a method of


which object?
a) connection b) database c) cursor d) query

43 Which of the following commands is not a DDL command?


(a) DROP (b) DELETE (c) CREATE (d) ALTER

44 Which of the following SQL statements is used to open a database named “SCHOOL”?
a) CREATE DATABASE SCHOOL; (b) USE DATABASE SCHOOL;
(c) USE SCHOOL; (d) SHOW DATABASE SCHOOL;

45 A relation can have only one______key and one or more than one______keys.
(a) PRIMARY, CANDIDATE (b) CANDIDATE, ALTERNATE
(c )CANDIDATE ,PRIMARY (d) ALTERNATE, CANDIDATE

46 What are the minimum number of attributes required to create a table in MySQL?
(a) 1 (b) 2 (c) 0 (d)3

47 SUM(), ANG() and COUNT() are examples of ______functions.


(a) single row functions (b) multiple row functions
(c) math function (d) date function

48 What are the mandatory arguments which are required to connect a MySQL database to
python?
(a) username, password, hostname, database name
(b) username, password, hostname
(c) username, password, hostname, port
(d) username, password, hostname, table name

49 Identify the SQL query which is expected to delete all rows of a table emp without deleting
its structure and write the correct one:
(a) DELETE TABLE emp; (b) DROP TABLE emp;
(c) REMOVE TABLE emp; (d) DELETE FROM emp;

50 All attribute combinations inside a relation that can serve as primary key are ________
(a) Primary Key b) Foreign Key (c) Candidate Key (d) Alternate Key

51 Which is known as range operator in MySQL?


(a) IN (b) BETWEEN (c) IS (d) DISTINCT

52 All aggregate functions except _______ ignore null values in their input collection.
(a) Count (attribute) (b) Count (*) (c) Avg (d) Sum

53 A database ___________is a special control structure that facilitates the row by row
processing of records in the result set.
(a) Fetch (b) table (c) cursor (d) query

54 The ________ command is used in a WHERE clause to search for a specified pattern in a
column.
(a) match (b) similar (c) like (d) pattern

55 Which of the following commands is used to modify a table in SQL?


(a) MODIFY TABLE (b) DROP TABLE (c) CHANGE TABLE (d) ALTER TABLE

56 For each attribute of a relation, there is a set of permitted values, called the _______of
that attribute.
(a) cardinality (b) degree (c) domain (d) tuple

57 The SELECT statement when combined with __________ clause, returns records in
sorted order.
(a) SORT (b) ARRANGE (c) ORDER BY (d) SEQUENCE

58 In SQL, the aggregate function used to calculate and display the average of numeric values
in an attribute of a relation is:
(a) sum() (b) total() (c) count() (d) avg()

59 The name of the module used to establish a connection between Python and SQL database
is-
(a) mysql-connect (b) mysql-connector (c) mysql-interface (d) mysql-conn

60 __ command is used to a remove a tuple or many tuple(s) from a table / relation in SQL
(a) drop (b)delete (c) remove (d) alter

61 Which of the following commands will remove a particular table’s schema along with its
data, contained in a MySQL database?
a. DROP DATABASE b. ALTER TABLE c. DELETE FROM TABLE d. DROP TABLE

62 ........................is an attribute, which is not a primary key of a table but has a capability of
becoming a primary key.
a. Primary Key b. Foreign Key c. Candidate Key d. Alternate Key

63 To restrict repeated values from being entered under a column of table, while creating the
table in MySQL we take help of which of the following :
a. DESCRIBE b. NULL c. PRIMARY KEY d. DISTINCT

64 Which function is not an aggregate function ?


a. sum() b. total() c. count() d. avg()

65 Which of the following method is needed to create an object using whose method a query
is executed from python’s front end connected to a mysql database.
a. cursor( ) b. execute( ) c. Connect( ) d. fetchall( )

66 A table has initially 5 columns and 8 rows. Consider the following sequence of operations
performed on the table –
i. 8 rows are added ii. 2 columns are added
iii. 3 rows are deleted iv. 1 column is added
What will be the cardinality and degree of the table at the end of above operations?
(a) 13,8 (b) 8, 13 (c) 14,5 (d) 5,8

67 Which of the following constraint is used to prevent a duplicate value in a record?


(a) Empty (b) check (c) primary key (d) unique

68 The structure of the table/relation can be displayed using __________ command.


(a) view (b) describe (c) show (d) select

69 Which of the following clause is used to remove the duplicating rows from a select
statement?
(a) or (b) distinct (c) any (d)unique
70 Which of the following method is used to create a connection between the MySQL
database and Python?
(a) connector ( ) (b) connect ( ) (c) con ( ) (d) cont ( )

71 Which of the following commands can remove all the data from a table in a
MYSQL database?
a) DELETE b) DROP c) REMOVE d) ALTER

72 A candidate key, which is not the primary key of a table, is a/an _________.
a) Primary Key b) Foreign Key c) Candidate Key d) Alternate Key

73 Select the correct statement, with reference to SQL:


a) Aggregate functions ignore NULL
b) Aggregate functions consider NULL as zero or False
c) Aggregate functions treat NULL as a blank string
d) NULL can be written as 'NULL' also.

74 Which function is used to display the total number of data values (except
NULL) from a column in a table?
a) sum() b) total() c) count() d) IS NOT NULL

75 In context of Python - Database connectivity, the function fetchone() is a method of which


object?
a) connection b) database c) cursor d) query

76 ______ command is used to remove primary key from the table in SQL.
(a) update (b)remove (c) alter (d)drop

77 Which of the following commands will delete the table from MYSQL
database?
(a) DELETE TABLE (b) DROP TABLE (c) REMOVE TABLE (d) ALTER TABLE

78 _________ is a non-key attribute, whose values are derived from the primary key of
some other table.
(a) Primary Key (b) Foreign Key (c) Candidate Key

79 The SELECT statement when combined with __________ clause, returns records
without repetition.
(a) DESCRIBE (b) UNIQUE (c) DISTINCT (d) NULL

80 Which function is used to display the total number of records from table in a database?
(a) sum(*) (b) total(*) (c) count(*) (d) return(*)

81 Which function is used to display the total number of records from table in a database?
(a) sum(*) (b) total(*) (c) count(*) (d) return(*)

82 Which function is used to display the unique values of a column of a table?


a. sum() b. unique() c. distinct() d. return()

83 Number of records/ tuples/ rows in a relation or table of a database is referred to as


________
(a) Domain (b) Degree (c) Cardinality (d) Integrity
84 The __________________ clause is used for pattern matching in MySQL queries.
(a) ALL (b) DESC (c) MATCH (d) LIKE

85 Which of the following query is incorrect? Assume table EMPLOYEE with attributes
EMPCODE, NAME, SALARY and CITY.
(a) SELECT COUNT(*) FROM EMPLOYEE;
(b) SELECT COUNT(NAME) FROM EMPLOYEE;
(c) SELECT AVG(SALARY) FROM EMPLOYEE;
(d) SELECT MAX(SALARY) AND MEAN(SALARY) FROM EMPLOYEE;

86 Which one of the following syntax is correct to establish a connection between Python and
MySQL database using the function connect( ) of [Link] package? Assume that
import [Link] as mycon is imported in the program.
(a) [Link](host = “hostlocal”, user = “root”, password = “MyPass”)
(b) [Link](host = “localhost”, user = “root”, passwd = “MyPass”, database =
“test”)
(c) [Link](“host”=“localhost”, “user”= “root”, “passwd”=”MyPass”, “database”=
“test”)
(d) [Link](“localhost” = host, “root”=user, “MyPass”=passwd)

87 The correct definition of column ‘alias’ is


a. A permanent new name of column
b. A new column of a table
c. A view of existing column with different name
d. A column which is recently deleted

88 Which function is used to display the unique values of a column of a table?


a. sum() b. unique() c. distinct() d. return()

89 BETWEEN clause in MySQL cannot be used for


a) Integer Fields b) Varchar fields
c) Date Fields d) None of these

90 COUNT(*) function in MySQL counts the total number of _____ in a table.


a) Rows b) Columns c) Null values of column d) Null values of a row

91 Which of the following is not a method for fetching records from MySQL table using
Python interface?
a) fetchone() b) fetchrows() c) fetchall() d) fetchmany()

92 _____________ command is used to add a new column into an existing table in SQL.
(a) UPDATE (b) INSERT (c) ALTER (d) CREATE

93 Which of the following command is a DDL command?


(a) SELECT (b) GROUP BY (c) DROP (d) UNIQUE

94 The __________________ clause is used for pattern matching in MySQL queries.


(a) ALL (b) DESC (c) MATCH (d) LIKE

95 In MYSQL database, if a table, BOOK has degree 8 and cardinality 7, and another table,
SALE has degree 4 and cardinality 7, what will be the degree and cardinality of the
Cartesian product of BOOK and SALE ?
a) 32 , 49 b) 12, 49 c) 12 ,14 d) 32,14

96 The SQL keyword ---------------- is used in SQL expression to select records based on
patterns

97 In the relational models , cardinality actually refers to --------------


a) Number of tuples b) Number of attributes
c) Number of tables d) Number of constraints

98 In a table in MYSQL database, an attribute A of datatype char(20)has the value


“Rehaan”. The attribute B of datatype varchar(20) has value “Fatima”. How many
characters are occupied by attribute A and attribute B?
a. 20,6 b. 6,20 c. 9,6 d. 6,9

99 In MYSQL database, if a table, Workshas degree 3 and cardinality 3, andanother table,


Jobs has degree 3 and cardinality 3, what will be the degree and cardinality of the
Cartesian product of Worksand Jobs?
a. 9,9 b. 6,6 c. 9,6 d. 6,9

101 ____________is a candidate key which is not selected as a primary key.


a. Primary Key b. Foreign Key c. Candidate Key d. Alternate Key

102 Table A has 3 rows and 4 columns and Table B has 5 rows and 6 columns. What is
the degree and cardinality of Cartesian product of A and B?
a) Degree is 15 and Cardinality is 15 b) Degree is 10 and Cardinality is 10
c) Degree is 10 and Cardinality is 15 d) Degree is 15 and Cardinality is 10

103 Which of the following is not an Aggregate function.


a) COUNT b) MIN c) MAX d) DISTINCT

104 Which join combines each row from the first table with every row from the
second table to make the result set?
a. CROSS JOIN b. OUTER JOIN c. INNER JOIN d. EQUI JOIN

105 Which of the following constraint is used to prevent a duplicate value in a record?
(a) Empty (b) check (c) primary key (d) unique

106 The structure of the table/relation can be displayed using __________ command.
(a) view (b) describe (c) show (d) select

107 Which of the following clause is used to remove the duplicating rows from a select
statement?
(a) or (b) distinct (c) any (d)unique

108 Which of the following method is used to create a connection between the MySQL
database and Python?
(a) connector ( ) (b) connect ( ) (c) con ( ) (d) cont ( )

109 Which of the following is NOT a DML Command?


(a)Insert (b)Update (c)Drop (d)Delete

110 Which command is used to change some values in existing rows?


(a) CHANGE (b) MODIFY (c) ALTER (d) UPDATE
111 The attribute which have properties to be as referential key is known as.
(a) foreign key (b)alternate key (c) candidate key (d) Both (a) and (c)

112 To get counting of the returned rows, you may use................


(a) [Link] (b) [Link]
(c) [Link]() (d) [Link]()

113 _______Keyword is used to obtain Non-duplicated values in a SELECT query.


(a) ALL (b) DISTINCT (c) SET (d) HAVING

114 Which of the following is not valid cursor function while performing database operations
using python. Here Mycur is the cursor object?
(a) [Link]() (b) [Link]() (c) [Link](n) (d) [Link]()

115 command is used to remove the tuple from the table in SQL.
(a) update (b) remove (c) alter (d) delete

116 In MYSQL database, if a table, Emp has degree 10 and cardinality 5, and
another table, Dept has degree 5 and cardinality 10, what will be the degree
and cardinality of the Cartesian product of Emp and Dept ?
a. 50,15 b. 15,50 c. 50,50 d. 15,15

117 Which of the following statements is FALSE in reference to MySQL?


a. It is an RDBMS. b. It is case sensitive.
c. It is an open source. d. It is ideal for both small and large applications.

118 ________command is used to change the structure of the table in SQL.


(a)update (b)remove (c)alter (d)drop

119 Which of the following commands will delete the contents of the table from MYSQL
database?
(a) DELETE (b) DROPTABLE (c) REMOVETABLE (d) ALTERTABLE

120 ___________is an attribute or set of attributes eligible to become primary key.


(a) PrimaryKey (b) ForeignKey (c) CandidateKey (d) Alternate Key

121 Which clause is used to apply conditions with GROUP BY


(a) WHERE (b) HAVING (c) LIKE (d) None Of These

122 Which function is used to establish connection between python and SQL database?
(a) connection (b) connect (c) getconnection (d) getconnect

123 ____Command is used to change the structure of the table in SQL.


(a)update (b)remove (c)alter (d)drop

124 What is the full form of SQL?


(a) Structured Query Language (b) Structured Query List
(c) Simple Query Language (d) Data Derivation Language

125 What does DML stand for?


(a) Different Mode Level (b) Data Model Language
(c) Data Mode Lane (d) Data Manipulation Language
126 The __________clause of SELECT query allows us to select only those rows in the
results that satisfy a specified condition.
(a) Where (b) from (c) having (d) like

127 Which of the following function is used to FIND the largest value from the given data in
MYSQL?
(a) MAX () (b) MAXIMUM () (c) LARGEST () (d) BIG ()

128 The data types CHAR (n) and VARCHAR (n) are used to create _______ and _______
types of string/text fields in a database.
(a) Fixed, equal (b) Equal, variable (c) Fixed, variable (d) Variable, equal

129 The term ___________ is use to refer to a record in a table.


(a) Attribute (b) Tuple (c) Row (d) Instance

130 A relational database consists of a collection of


(a) Tables (b) Fields (c) Records (d) Keys

131 What is the full form of DDL?


(a) Dynamic Data Language (b) Detailed Data Language
(c) Data Definition Language (d) Data Derivation Language

132 A(n) _________in a table represents a logical relationship among a set of values.
(a) Attribute (b) Key (c) Tuple (d) Entry

133 Name the method which is used for displaying only one resultset.
(a) fetchmany (b) fetchno (c) fetchall (d) fetchone

134 A relational database consists of a collection of


(a)Tuples (b) Attributes (c) Relations (d) Keys

135 Which is the subset of SQL commands used to manipulate database structure including
tables?
(a) Data Definition Language (DDL) (b) Data Manipulation Language (DML)
(c) Both (a) and (b) (d) None

136 The term ____________ is used to refer to a field in a table.


(a) Attribute (b) Tuple (c) Row (d) Instance

137 Consider the following query


SELECT name FROM stu WHERE subject LIKE ‘_______ Computer Science’;
Which one of the following has to be added into the blank space to select the subject which
has Computer Science as its ending string?
(a) $ (b) _ (c) || (d) %

138 Consider following SQL statement. What type of statement is this?


SELECT * FROM employee
(a) DML (b) DDL (c) DCL (d) Integrity constraint

139 Which of the following function is not an aggregate function?


(a) Round() (b) Sum() (c) Count () (d) Avg ()

140 Aggregate functions can be used in the select list or the _____ clause of a select
statement. They cannot be used in a ______ clause.
(a) Where, having (b) Having, where (c) Group by, having (d) Group by, where

141 Select correct SQL query from below to find the temperature in increasing order of all
cites.
(a) SELECT city FROM weather ORDER BY temperature;
(b) SELECT city, temperature FROM weather;
(c) SELECT city, temperature FROM weather ORDER BY temperature;
(d) SELECT city, temperature FROM weather ORDER BY city;

142 In SQL, which command is used to SELECT only one copy of each set of duplicable rows
(a) SELECT DISTINCT (b) SELECT UNIQUE
(c) SELECT DIFFERENT (d) All of the above

143 The command used for modifying the records is:


(a) update (b) add (c) updateall (d) none of the above

144 Which of the following sublanguages of SQL is used to query information from the data
base and to insert tuples into, delete tuples from, and modify tuples in the database?
(a) DML (Data Manipulation Language) (b) DDL (Data Definition Language)
(c) Query (d) Relational Schema

145 Which operator performs pattern matching?


(a) BETWEEN operator (b) LIKE operator (c) EXISTS operator (d) None of these

146 Which of the following is not a legal method for fetching records from database from
within Python?
(a) fetchone() (b) fetchtwo() (c) fetchall() (d) fetchmany()

147 By default, ORDER BY clause lists the results in _______ order.


(a) Descending (b) Any (c) Same (d) Ascending

148 Which of the following attributes can be considered as a choice for primary key?
(a)Name (b)Street (c) Roll No (d) Subject

149 In the given query which keyword has to be inserted?


INSERT INTO employee______(1002, “Kausar”, 2000);
(a) Table (b) Values (c) Relation (d) Field

150 What SQL statement do we use to display the record of all students whose last name
contains 5 letters ending with “A”?
(a) SELECT * FROM STUDENTS WHERE LNAME LIKE ‘_ _ _ _A’;
(b) SELECT * FROM STUDENTS WHERE LNAME LIKE ‘ _ _ _ _ _’;
(c) SELECT * FROM STUDENTS WHERE LNAME LIKE ‘ ????A’;
(d) SELECT * FROM STUDENTS WHERE LNAME LIKE ‘*A’;

151 Consider the table with structure as:


Student (ID, name, dept name, tot_cred)
In the above table, which attribute will form the primary key?
(a)Name (b) Dept (c) total_credits (d) ID

152 Which of the following will you use in the following query to display the unique values of
the column dept_name?
SELECT _____________ dept_name FROM Company;
(a)All (b) From (c) Distinct (d) Name

153 Consider the following query:


SELECT name, instructor name, course______id
FROM instructor;
To display the field heading course with a different heading as id, which keyword must be
used here to rename the field name?
(a)From (b) Rename (c) As (d) Join

154 With SQL, how do you select all the records from a table named “Students” where the
value of the column “FirstName” ends with an “a”?
(a) SELECT * FROM Students WHERE FirstName =’a’
(b) SELECT * FROM Students WHERE FirstName LIKE ‘a%’
(c) SELECT * FROM Students WHERE FirstName LIKE ‘%a’
(d) SELECT * FROM Students WHERE FirstName =’%a%’

155 The HAVING clause does which of the following?


(a) Acts EXACTLY like WHERE clause
(b) Acts like a WHERE clause but is used for columns rather than groups.
(c) Acts like a WHERE clause but is used form groups rather than rows.
(d) Acts like a WHERE clause but is used for rows rather than columns.

156 Which clause is used with “aggregate functions”?


(a) GROUP BY (b) SELECT (c) WHERE (d) Both (a) and (b)

157 To open a connector to Mysql database, which statement is used to connect with mysql?
(a) Connector (b) Connect (c) password (d) username

158 If column “Marks” contains the data set {25, 35, 25, 35, 38}, what will be the output after
the execution of the given query?
SELECT MARKS (DISTINCT) FROM STUDENTS;
(a) 25. 35. 25. 35. 38 (b) 25, 25, 35, 35 (c) 25, 35, 38 (d) 25, 25, 35, 35

159 Which connector is used for linking the database with Python code?
(a) MySQL-connector (b) YesSQL: connector
(c) PostSQL: connector (d) None of the above

160 If column “Salary” contains the data set {1000, 15000, 25000, 10000, 15000}, what will
be the output after the execution of the given query?
SELECT SUM(DISTINCT SALARY) FROM EMPLOYEE;
(a)75000 (b) 25000 (c) 10000 (d) 50000

161 SQL applies conditions on the groups through _____ clause after groups have been
formed.
a) Group by (b) With (c) Where (d) Having

162 What is the meaning of “HAVING” clause is SELECT query?


(a) To filter out the summary groups (b) To filter out the column groups
(c) To filter out the row and column values (d) None of the mentioned
163 Which of the following queries contains an error?
(a) Select * from emp where empid = 10003;
(b) Select empid from emp where empid=10006;
(c) Select empid from emp;
(d) Select empid where empid=1009 and lastname=’GUPTA’;

164 Which operator tests column for the absence of data (i.e., NULL value) ?
(a) EXISTS operator (b) NOT operator (c) IS operator (d) None of these

165 Consider the following query:


SELECT name FROM class WHERE subject_____NULL;
Which comparison operator may be used to fill the blank space in above query?
(a) = (b) LIKE (c) IS/IS Not (d) if

166 With SQL, how can you return the number of not null record in the Project field of
“Students” table?
(a) SELECT COUNT (Project) FROM Students
(b) SELECT COLUMNS (Project) FROM Students
(c) SELECT COLUMNS (*) FROM Students
(d) SELECT COUNT (*) FROM Students

167 What will be the order of the data being sorted after the execution of given query
SELECT * FROM STUDENT ORDER BY ROLL_NO;
(a)Custom Sort (b) Descending (c) Ascending (d) None of the above

168 Where and Having clauses can be used interchangeably in SELECT queries?
(a) True (b) False (c) Only in views (d) With order by

167 A______ is property of the entire relation, which ensures through its value that each
tuple is unique in a relation.
(a) Rows (b) Key (c) Attribute (d) fields

168 The operation whose result contains all pairs of tuples from the two relations, regardless of
whether their attribute values match.
(a) Join (b) Cartesian product (c) Intersection (d) Set difference

169 Consider following SQL statement. What type of statement is this?


CREATE TABLE employee (name VARCHAR, id INTEGER)
(a) DML (b) DDL (c) DCL (d) Integrity constraint

170 The pattern ‘- - - ’ matches any string of ________ three character. ‘- - - %’ matches any
string of ____ three characters.
(a) Atleast, Exactly (b) Exactly, Atleast (c) Atleast, All (d) All, Exactly

171 The SQL keyword_______ is used to specify the table(s) that contains the data to be
retrieved.

172 To remove duplicate rows from the result of a query, specify the SQL qualifier________
in select list.

173 To obtain all columns, use a(n) _________ instead of listing all the column names in the
select list.
174 The SQL _______ clause contains the condition that specifies which rows are to the
selected.

175 To sort the rows of the result table, the _________ ________ clause is specified.

176 Columns can be sorted in descending sequence by using the SQL keyword
____________

177 When two conditions must both be true for the rows to be selected, the conditions are
separated by the SQL keyword ________

178 To refer to a set of values needed for a condition, we can use the SQL operation
__________

179 The SQL built-in function ________ totals values in numeric columns.

180 The SELECT clause _________ is used to collect those rows that have the same value in
a specified column.

181 The SQL built-in function __________ computes the number of rows in a table.

182 To exclude one or more values (a list of values) using a condition, the SQL keyword
________ ________ should be used.

183 ______________ method returns the result set in the form of tuples containing the
records or rows returned by the sql table.

184 The ______________ function works with data of multiple rows at a time and returns
aggregated value.

185 To specify filtering condition for groups, the _____________ clause is used in MYSQL.

186 To sort the result set in descending order, ___________ keyword is used with ORDER
BY.

State True orFalse:

187 The condition in a WHERE clause in a SELECT query can refer to only one value

188 SQL provides the AS keyword, which can be used to assign meaningful column names to
the results of queries using the SQL built-in functions.

189 The rows of the result relation produced by a SELECT statement can be sorted but only by
one column.

190 SELECT DISTINCT is used if a user wishes to see duplicate columns in a query.

191 The HAVING clause acts like a WHERE clause, but it identifies groups that meet a
criterion, rather than rows.

192 The qualifier DISTINCT must be used in an SQL statement when we want to Eliminate
duplicate rows.

193 DISTINCT and its counterpart, ALL, can be used more than once in a SELECT statement.
194 The SQL statement: SELECT salary + Comm AS Total FROM Emp; adds two fields salary
and comm from each row together and lists the results in a column named Total.

195 ORDER BY can be combined with the SELECT statement.

196 Data manipulation language (DML) commands are used to define a database, including
creating, altering, and dropping tables and establishing constraints.

197 The keyword LIKE can be used in a WHERE clause to refer to a range of values.

198 The SQL keyword GROUP BY instructs the DBMS to group together those rows that have
the same value in a column.

199 The keyword BETWEEN can be used in a WHERE clause to refer to a range of values.

200 Read operation on any table means to fetch some useful information from the table.

201 Use fetchall() method to retrieve only one value from a database table.

202 DISTINCT and its counterpart, ALL, can be used together on single field in a SELECT
statement.

203 Row count is a read-only attribute.

204 To disconnect database connection, use connect () method.

205 Update statement is used to insert data into the table.

206 The ORDER BY clause combines all those records that have identical values in a particular
field or a group of fields.

207 The WHERE clause is used to specify filtering conditions for groups.

208 DISTINCT option causes a group function to consider only the unique values of the
argument expression.

209 By default, ORDER BY clause sorts the result set in descending order.

210 COUNT () function ignores duplicate and null values while counting the records.

211 The return value of MAX () function is a numeric value.

212 Multiple row function is also known as scalar function

213 SUM () function is used to count the total number of records in a table.

214 Argument type of AVG () function can be numeric or string data type.

215 MySQL statement to delete a table STUDENT from the database SCHOOL is
DELETE TABLE STUDENT;

216 Where and Having clauses can be used interchangeably in SQL queries.

217 What is the domain of an attribute?


(a) The set of possible values that the attribute can take
(b) The name of the attribute
(c) The data type of the attribute
(d) None of the above

218 Which of the following is not a database constraint?


a. CHECK b. DEFAULT c. UNIQUE d. NULL

219 Which command is used to open the database “SCHOOL”?


a. USE SCHOOL b. OPEN SCHOOL
c. USE DATABASE SCHOOL d. SHOW SCHOOL

220 In the given query which keyword has to be inserted?


INSERT INTO employee______(1002, “Kausar”, 2000);
a) Value b) Values c) Values into d) Into Values

221 Which SQL statement is used to display all the data from PRODUCT table in the
decreasing order of PRICE?
a. SELECT * FROM PRODUCT ORDER PRICE BY DESC ;
b. SELECT * FROM PRODUCT PRICE ORDER BY DESC;
c. SELECT * FROM PRODUCT ORDER BY DESC PRICE;
d. SELECT * FROM PRODUCT ORDER BY PRICE DESC;

222 Which of the following function is used to FIND the largest value from the given
data in MYSQL?
a) MAX () b) MAXIMUM () c) LARGEST () d) BIG ()

223 Which keyword is used for aliasing a table?


a) ASC b) AS c) IS d) None of these

224 SELECT name FROM class WHERE subject_____NULL;


Which comparison operator may be used to fill the blank space in above query?
a) = b) LIKE c) IS d) <>

225 Which SQL statement is used to display all the data from ITEMS table where
INAME is ending with ‘L’?
a. SELECT * FROM ITEMS WHERE INAME LIKE ‘L%’;
b. SELECT * FROM ITEMS WHERE INAME LIKE ‘%L’;
c. SELECT * FROM ITEMS WHERE INAME LIKE ‘%L%’;
d. SELECT * FROM ITEMS WHERE INAME LIKE ‘_L_’;

226 Select the correct statement, with reference to RDBMS:


a) NULL can be a value in a Primary Key column
b) ' ' (Empty string) can be a value in a Primary Key column
c) A table with a Primary Key column cannot have an alternate key.
d) A table with a Primary Key column must have an alternate key.

227 _________ is an attribute, whose values are Unique and not null.
(A) Primary Key (B)Foreign Key (C)Candidate Key (D)Alternate Key

228 The command is used to access database in MySQL is-


(a) Open <databasename>; (b) USE <databasename>;
(c) Access <databasename>; (d) (a)&(b) both

229 How c n you in ert new row into the “STORE” t b e.


(a) NSERT ROW(1,‟RAMS NGH‟) NTO STORE;
(b) NSERT VALUES(1,‟RAMS NGH‟) NTO STORE;
(c) NSERT NTO(1,‟RAMS NGH‟)STORE;
(d) NSERT NTO STORE VALUES(1,‟RAMS NGH‟);

230 To see all the databases which command is used?


(a)Show database; (b) Show databases; (c) Show database(); (d) Show_all database;

231 .To di p y the det i of emp oyee h ving ‘e’ in their name in descending order of salary. The
correct
SQL statement is:
(a) SELE T*FROM emp WHERE en me L KE “e%” ORDER BY SAL;
(b) SELE T*FROM emp ORDER BY SAL DES WHERE en me L KE “%e%”;
(c) SELE T*FROM emp WHERE en me L KE “%e%” ORDER BY DES SAL;
(d) SELE T*FROM emp WHERE en me L KE “%e%” ORDER BY SAL DES ;

232 In which form MYSQL query results are displayed?


(a) LIST (b)TUPLE (c) ROWS AND COLUMNS (d) LIST AND TUPLES BOTH

233

234

235

236

237

238

239

240

You might also like