0% found this document useful (0 votes)
8 views23 pages

SQL Commands Objective Questions

The document consists of a series of objective questions related to SQL commands, covering topics such as data retrieval, table manipulation, and integrity constraints. Each question is followed by multiple-choice answers, with the correct answers indicated. The content serves as a study guide for understanding SQL basics and its functionalities.

Uploaded by

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

SQL Commands Objective Questions

The document consists of a series of objective questions related to SQL commands, covering topics such as data retrieval, table manipulation, and integrity constraints. Each question is followed by multiple-choice answers, with the correct answers indicated. The content serves as a study guide for understanding SQL basics and its functionalities.

Uploaded by

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

DATA PROCESSING YEAR 11 180

OBJECTIVE QUESTIONS ON SQL COMMANDS


1. SQL stands for
A. Structured Question Language
☑️B. Structured Query Language
C. System Query List
D. Simple Query Language
2. The SQL command used to retrieve data is
A. UPDATE
☑️B. SELECT
C. DELETE
D. DROP
3. Which command is used to insert new records?
A. APPEND
☑️B. INSERT
C. ADD
D. PUT
4. Which keyword is used to remove duplicate values?
A. UNIQUE
☑️B. DISTINCT
C. ONLY
D. SPECIAL
5. The command used to change existing data is
A. ALTER
☑️B. UPDATE
C. MODIFY
D. CHANGE
6. The command used to delete a table from a database is
A. ERASE TABLE
B. REMOVE TABLE
☑️C. DROP TABLE
D. DELETE TABLE
7. Which clause sorts data?
A. SORT BY
B. GROUP BY
☑️C. ORDER BY
D. FILTER BY
8. Which SQL statement creates a database table?
☑️A. CREATE TABLE
B. MAKE TABLE
C. NEW TABLE
D. BUILD TABLE
9. The WHERE clause is used to
☑️A. Filter records
B. Sort records
C. Join tables
D. Delete a table
10. Which operator is used for pattern matching?
A. =
B. <>
☑️C. LIKE
D. MATCH
11. Which SQL command removes all records but keeps the structure?
☑️A. TRUNCATE
B. DELETE
C. DROP
D. REMOVE
12. The symbol used for selecting all columns is
A. #
B. @
☑️**C. ***
D. %
13. Which command changes the structure of a table?
A. MODIFY
☑️B. ALTER TABLE
C. RENAME
D. UPDATE
14. SQL command used to delete specific records
A. TRUNCATE
☑️B. DELETE
C. DROP
D. CLEAR
15. Which clause groups rows having same values?
A. ORDER BY
☑️B. GROUP BY
C. SORT BY
D. SUM BY
16. The SQL command to rename a table is
☑️A. RENAME
B. NEWNAME
C. CHANGE
D. SHIFT
17. Which of these is a comparison operator?
A. AND
B. OR
☑️C. >
D. NOT
18. SQL is mainly used for
A. Designing webpages
☑️B. Managing databases
C. Creating pictures
D. Running games
19. The AND operator requires
☑️A. Both conditions to be true
B. One condition to be false
C. Only one true
D. No condition
20. The OR operator requires
A. Both conditions to be false
☑️B. At least one condition to be true
C. Both true
D. None true
21. A table row is called
A. Field
☑️B. Record
C. Column
D. Attribute
22. A table column is called
A. Row
☑️B. Field
C. Tuple
D. Cell
23. SQL command used to remove a database
A. ERASE
☑️B. DROP DATABASE
C. DELETE DATABASE
D. REMOVE DATABASE
24. Which function counts records?
A. TOTAL
☑️B. COUNT()
C. SUM()
D. NUMBER()
25. Which function gives the highest value?
A. MIN()
☑️B. MAX()
C. TOP()
D. HIGH()
26. Which function calculates average?
A. MEDIAN()
B. MEAN()
☑️C. AVG()
D. MID()
27. Which keyword joins tables?
A. GROUP
☑️B. JOIN
C. MERGE
D. CONNECT
28. The BETWEEN operator checks
A. Strings only
☑️B. A range of values
C. One value
D. None
29. Which clause limits number of returned rows?
A. SHORTEN
☑️B. LIMIT
C. STOP
D. END
30. The NOT operator
A. Makes conditions true
☑️B. Reverses a condition
C. Joins tables
D. Sorts values
31. The IN operator checks
A. Equality
☑️B. Whether a value is in a list
C. Sorting
D. Joins
32. The HAVING clause is used with
A. ORDER BY
☑️B. GROUP BY
C. WHERE
D. JOIN
33. A primary key must be
A. Null
B. Duplicated
☑️C. Unique and not null
D. Random
34. Foreign keys are used to
A. Delete records
☑️B. Link tables
C. Sort data
D. Format tables
35. The default sort order is
A. DESC
☑️B. ASC
C. RANDOM
D. NONE
36. The SQL command to add a column
A. INSERT
☑️B. ALTER TABLE ADD
C. UPDATE ADD
D. CREATE COLUMN
37. Which type of SQL command is SELECT?
A. DDL
B. DCL
☑️C. DML
D. TCL
38. DROP TABLE belongs to
A. DML
☑️B. DDL
C. DCL
D. TCL
39. Which is a transactional command?
A. COMMIT
B. ROLLBACK
☑️C. BOTH A and B
D. SELECT
40. SQL keywords are
A. Case-sensitive
☑️B. Not case-sensitive
C. Only uppercase
D. Only lowercase
41. Which clause comes first in a SELECT query?
☑️A. SELECT
B. WHERE
C. FROM
D. ORDER BY
42. Which statement is correct SQL syntax?
☑️A. SELECT * FROM Students;
B. SELECT FROM * Students;
C. GET * Students;
D. SHOW Students;
43. The symbol <> means
A. Equal to
☑️B. Not equal to
C. Greater
D. Less
44. SUM function works on
A. Text
☑️B. Numbers
C. Dates
D. Fields only
45. DELETE removes
A. Table structure
☑️B. Table records
C. Database
D. All tables
46. Which of these is a SQL data type?
A. PICTURE
☑️B. VARCHAR
C. BUTTON
D. PAGE
47. CHAR data type stores
A. Pictures
☑️B. Fixed-length text
C. Long text
D. Numbers
48. The LIKE pattern %a means
☑️A. Ends with a
B. Starts with a
C. Contains only a
D. Not a
49. Which SQL command grants privileges?
A. ALLOW
☑️B. GRANT
C. PERMIT
D. ENABLE
50. Which SQL command removes privileges?
A. UNGRANT
☑️B. REVOKE
C. DELETE
D. REMOVE
51. Which of the following is NOT an integrity constraint?
A. Primary key
B. Foreign key
C. Check
D. Print key ✓
52. A primary key must be
A. Unique ✓
B. Duplicated
C. Null
D. A foreign key
53. A column with a UNIQUE constraint must contain:
A. No values
B. Only duplicate values
C. Distinct values ✓
D. Null values only
54. Which constraint prevents NULL values in a column?
A. CHECK
B. NOT NULL ✓
C. FOREIGN KEY
D. DEFAULT
55. A foreign key enforces:
A. Duplication of data
B. Referential integrity ✓
C. Arithmetic operations
D. Nullifying data
56. Which constraint ensures a value belongs to a referenced table?
A. PRIMARY KEY
B. UNIQUE
C. FOREIGN KEY ✓
D. CHECK
57. What does a CHECK constraint do?
A. Limits values to meet a condition ✓
B. Creates a new table
C. Formats data
D. Deletes data
58. The PRIMARY KEY constraint automatically implies:
A. UNIQUE and NOT NULL ✓
B. CHECK
C. DEFAULT
D. NULL
59. Referential integrity means:
A. Deleting all data
B. Data in child table must match parent table ✓
C. Data must be numeric
D. Data must be text
60. Which of these can be NULL?
A. Primary key
B. Unique key
C. Foreign key ✓
D. Not null column

61. What happens if you insert a foreign key value not in the parent
table?
A. It is accepted
B. It is deleted
C. It causes an error ✓
D. It becomes NULL
62. A DEFAULT constraint:
A. Deletes values
B. Inserts a preset value if none is provided ✓
C. Forces uniqueness
D. Checks conditions
63. Which SQL keyword is used to define a primary key?
A. PRIMARY KEY ✓
B. MAIN KEY
C. UNIQUE KEY
D. BASE KEY
64. Integrity constraints are used to:
A. Enforce rules on data ✓
B. Delete unwanted data
C. Format output
D. Change table names
65. A UNIQUE constraint allows how many NULLs?
A. None
B. One ✓
C. Two
D. Unlimited
66. Which integrity constraint creates a relationship between two
tables?
A. CHECK
B. DEFAULT
C. UNIQUE
D. FOREIGN KEY ✓
67. Which constraint ensures data accuracy?
A. Comments
B. Integrity constraints ✓
C. Functions
D. Joins
68. A CHECK constraint can be applied on:
A. Only primary key
B. Only foreign key
C. Any column ✓
D. No column
69. Which constraint can prevent negative age values?
A. PRIMARY KEY
B. CHECK ✓
C. UNIQUE
D. DEFAULT
70 A NOT NULL constraint ensures that:
A. Values must be text
B. Values cannot be empty ✓
C. Values must be numbers
D. Values must be unique
71. Which action maintains referential integrity?
A. Using a foreign key ✓
B. Using SELECT
C. Using PRINT
D. Using COUNT
72. Which clause removes a constraint?
A. DELETE
B. DROP CONSTRAINT ✓
C. REMOVE
D. TRIM
73. Which of these is a domain constraint?
A. FOREIGN KEY
B. CHECK(age > 0) ✓
C. PRIMARY KEY
D. NOT NULL
74. The term “candidate key” means:
A. A potential primary key ✓
B. A deleted key
C. A wrong key
D. A foreign key
75. Integrity constraints help to:
A. Corrupt data
B. Maintain data correctness ✓
C. Increase errors
D. Format reports
76. Which constraint is mostly used to avoid duplicate student IDs?
A. NOT NULL
B. UNIQUE
C. PRIMARY KEY ✓
D. FOREIGN KEY
77. Which constraint ensures that data meets a logical condition?
A. CHECK ✓
B. DROP
C. PRINT
D. UPDATE
78. A foreign key must reference:
A. A primary key or unique key in another table ✓
B. A text field
C. A null field
D. A date field
79. Oracle and MySQL both support:
A. Primary key constraint ✓
B. Magic key
C. Null key
D. Show key
80. DEFAULT constraints are used to:
A. Provide automatic values ✓
B. Delete rows
C. Drop tables
D. Modify references
81. Referential integrity ensures:
A. Data in the child table is valid ✓
B. Data is always text
C. Data is always numeric
D. All tables are identical
82. Which of the following is NOT a domain constraint?
A. CHECK
B. Data type
C. FOREIGN KEY ✓
D. NOT NULL
83. A primary key can consist of:
A. One or more columns ✓
B. Only one column
C. Only text fields
D. Only numeric fields
84. If a column is NOT NULL, it means:
A. Null is allowed
B. Null is not allowed ✓
C. Duplicates are not allowed
D. Values must be zero
85. Foreign key values may be:
A. Always unique
B. Always null
C. Null or matching a parent key ✓
D. Negative numbers only
86. A UNIQUE constraint prevents:
A. Nulls
B. Duplicate values ✓
C. Negative numbers
D. Text values
87. Domain constraints define:
A. The range and type of values ✓
B. The number of tables
C. Table names
D. Column order
88. An entity integrity constraint applies to:
A. Foreign key
B. Primary key ✓
C. Check constraint
D. Default
89. What does SQL use to enforce rules on tables?
A. Constraints ✓
B. Filters
C. Forms
D. Macros
90. CHECK (age >= 18) ensures:
A. Age must be 18 or above ✓
B. Age must be text
C. Age must be null
D. Age must be 0

91. Foreign keys help maintain:


A. Data redundancy
B. Table formatting
C. Referential integrity ✓
D. Colour coding
92. Which SQL constraint guarantees minimal duplication?
A. DEFAULT
B. UNIQUE ✓
C. DROP
D. VIEW
93. Entity integrity ensures:
A. A table has no rows
B. Primary key values are not null ✓
C. Data is text only
D. There is no foreign key
94. A composite key is:
A. A key made of multiple columns ✓
B. A foreign key
C. A null key
D. A temporary key
95. DEFAULT ‘Nigeria’ means:
A. Value must be Nigeria
B. If no value is given, Nigeria is used ✓
C. Nigeria cannot be used
D. Value must be null

96. Which constraint stops deleting a referenced parent row?


A. ON UPDATE
B. FOREIGN KEY ✓
C. NOT NULL
D. DEFAULT
97. Which constraint ensures uniqueness but allows one NULL?
A. PRIMARY KEY
B. UNIQUE ✓
C. CHECK
D. FOREIGN KEY
98. CHECK(score BETWEEN 0 AND 100) enforces:
A. Only negative scores
B. Scores must be 0 or 100
C. Scores within the allowed range ✓
D. Random scores
99. Referential integrity is violated when:
A. A child row references a non-existing parent ✓
B. A row is selected
C. A column is formatted
D. A table is printed
100. Constraints are applied using which SQL command?
A. INSERT
B. SELECT
C. CREATE TABLE ✓
D. PRINT
101. SQL stands for
A. Structured Query Language ✔️
B. Simple Query List
C. System Question Language
D. Standard Query Link
102. A table in SQL is also called a
A. Relation ✔️
B. Entity
C. Column
D. Key
103. Rows in a table are called
A. Fields
B. Attributes
C. Records ✔️
D. Columns
104. Columns in a table are called
A. Rows
B. Fields ✔️
C. Tuples
D. Relations
105. Which SQL command is used to retrieve data?
A. UPDATE
B. DELETE
C. SELECT ✔️
D. INSERT
106. Which SQL statement selects all columns?
A. SELECT ALL
B. SELECT * ✔️
C. GET *
D. SHOW *
107. Which keyword is used to remove duplicates?
A. UNIQUE
B. DISTINCT ✔️
C. SEPARATE
D. DIFFERENT
108. To select rows that meet a condition, SQL uses the
A. WHERE clause ✔️
B. WHAT clause
C. HAVING clause
D. FROM clause
109. Which query selects all students aged 14?
A. SELECT * FROM Students WHERE age = 14; ✔️
B. SELECT age = 14 FROM Students;
C. GET Students IF age = 14;
D. SHOW Students age 14;
110. The ORDER BY clause is used to
A. Filter rows
B. Sort results ✔️
C. Delete data
D. Update data
111. ASC means
A. Ascending order ✔️
B. Automatic search
C. Ascertain
D. Assemble
112. DESC means
A. Decrease speed
B. Descending order ✔️
C. Describe
D. Decision
113. Which operator is used for pattern matching?
A. LIKE ✔️
B. MATCH
C. PATTERN
D. =
114. The wildcard % means
A. One character
B. Many characters ✔️
C. No character
D. Only numbers
115. The wildcard _ means
A. Any one character ✔️
B. Any number
C. Any symbol
D. Space
116. Which operator checks for a range?
A. BETWEEN ✔️
B. RANGE
C. LIMIT
D. CHECK
117. Which operator checks for a list of values?
A. IN ✔️
B. LIST
C. HAS
D. WITH
118. Which retrieves all students whose age is NOT 15?
A. WHERE age = 15
B. WHERE age <> 15 ✔️
C. WHERE age IN 15
D. WHERE NOT age
119. SQL joins are used to
A. Delete tables
B. Combine data from tables ✔️
C. Create keys
D. Sort values
120. The primary key must be
A. Repeated
B. Null
C. Unique ✔️
D. Hidden
121. To rename a column in a query, we use
A. RENAME
B. AS ✔️
C. LIKE
D. CALL
122. Which is the correct use of AS?
A. SELECT name AS student name FROM Students; ✔️
B. SELECT name student name FROM AS Students;
C. SELECT AS name FROM Students;
D. AS SELECT name FROM Students;
123. Aggregation function that counts rows
A. TOTAL
B. SUM
C. COUNT ✔️
D. NUMBER
124. Aggregation function that returns average
A. AVG ✔️
B. MEAN
C. MID
D. AVERAGE
125. Which returns the highest value?
A. TOP
B. MAX ✔️
C. HIGH
D. UP
126. Which SQL statement calculates the sum of scores?
A. SELECT TOTAL(score) FROM Students;
B. SELECT SUM(score) FROM Students; ✔️
C. ADD score FROM Students;
D. SHOW sum score;
127. HAVING is used with
A. ORDER BY
B. GROUP BY ✔️
C. SELECT ONLY
D. WHERE ONLY
128. GROUP BY groups rows that
A. Are sorted
B. Have the same values ✔️
C. Have different values
D. Are deleted
129. Which shows students grouped by class?
A. GROUP Students BY class;
B. SELECT * CLASS Students;
C. SELECT class, COUNT(*) FROM Students GROUP BY class; ✔️
D. SELECT GROUP class Students;
130. To remove all records from a table
A. DELETE * FROM table ✔️
B. REMOVE table
C. CLEAR table
D. DROP table
131. To delete an entire table
A. CLEAR Students
B. DELETE Students
C. DROP TABLE Students ✔️
D. REMOVE TABLE Students
132. To update a student's score
A. ALTER score
B. UPDATE Students SET score=90 ✔️
C. CHANGE score 90
D. MODIFY Students score
133. The FROM clause identifies
A. Columns
B. Tables ✔️
C. Keys
D. Functions
134. Which finds names starting with ‘A’?
A. WHERE name = 'A%'
B. WHERE name LIKE 'A%' ✔️
C. WHERE name HAS 'A'
D. WHERE name START 'A'
135. Which finds phone numbers containing 24?
A. WHERE phone LIKE '%24%' ✔️
B. WHERE phone = '24'
C. WHERE phone IN 24
D. WHERE phone BETWEEN 2 AND 4
136. Which query limits results to 5 rows?
A. SELECT * FROM Students CAP 5;
B. SELECT * FROM Students TAKE 5;
C. SELECT * FROM Students LIMIT 5; ✔️
D. SELECT 5 FROM Students;
137. Which operator represents "not equal"?
A. ==
B. =/=
C. <> ✔️
D. ><
138. A foreign key links
A. Two rows
B. Two schemas
C. Two tables ✔️
D. Two queries
139. SQL commands that deal with data retrieval are
A. DDL
B. DCL
C. DML ✔️
D. DSL
140. To sort by two columns
A. ORDER BY column1, column2 ✔️
B. ORDER column1 column2
C. SORT column1; column2
D. ORDER column1 & column2
141. A NULL value means
A. Zero
B. Empty string
C. Unknown or missing ✔️
D. Negative
142. Which query checks for NULL?
A. WHERE age = NULL
B. WHERE age IS NULL ✔️
C. WHERE age LIKE NULL
D. WHERE NULL age
143. Which is a valid comparison operator?
A. ABOVE
B. UNDER
C. >= ✔️
D. NOT
144. The keyword used to join tables with matching columns
A. MATCH JOIN
B. EQUATE
C. INNER JOIN ✔️
D. COMBINE
145. Which selects distinct classes?
A. SELECT ONLY class FROM Students;
B. SELECT DISTINCT class FROM Students; ✔️
C. SELECT UNIQUE class FROM Students;
D. SELECT class UNIQUE;
146. To calculate number of classes
A. SELECT COUNT(class) FROM Students;
B. SELECT COUNT(DISTINCT class) FROM Students; ✔️
C. SELECT SUM(class) FROM Students;
D. SELECT DISTINCT COUNT(class);
147. To find students aged between 12 and 16
A. WHERE age IN 12 TO 16
B. WHERE age BETWEEN 12 AND 16 ✔️
C. WHERE age RANGE 12 16
D. WHERE age LIMIT 12 16
148. Which performs pattern search?
A. LIKE ✔️
B. FIND
C. SORT
D. MATCHES
149. Which selects students whose score is greater than 70?
A. WHERE score > 70 ✔️
B. WHERE score >=< 70
C. WHERE score ABOVE 70
D. WHERE score => 70
150. Which is used to combine query results?
A. MERGE
B. UNION ✔️
C. GROUP
D. ATTACH
151. Which of the following is NOT a type of file organization?
A. Sequential
B. Direct
C. Indexed
D. Blueprint ✓
152. In which file organization are records stored one after another?
A. Sequential ✓
B. Direct
C. Random
D. Indexed
153. Another name for direct file organization is ___.
A. Sequential
B. Random ✓
C. Indexed
D. Serial
154. Which file organization uses a key field to calculate storage location?
A. Sequential
B. Random ✓
C. Indexed
D. Serial
155. Which is best for large batch processing?
A. Sequential ✓
B. Random
C. Indexed
D. Direct
156. Which file organization is most suitable for payroll systems?
A. Indexed
B. Sequential ✓
C. Random
D. Hierarchical
157. Which type uses an index to locate records?
A. Sequential
B. Indexed ✓
C. Random
D. Direct
158. A disadvantage of sequential file organization is that ___.
A. It is easy to update
B. It is slow for searching ✓
C. It is very expensive
D. It requires hashing
159. Which file organization is fastest for searching?
A. Sequential
B. Indexed
C. Random ✓
D. Serial
160. The storage location of a record in direct organization is obtained using ___.
A. Pointer
B. Hash function ✓
C. Index table
D. Accumulator
161. Which file organization is best for transaction-based systems?
A. Sequential
B. Indexed
C. Random ✓
D. Serial
162. Indexed file organization uses ___.
A. Pointers
B. Hashing
C. Index table ✓
D. Queue
163. Which file organization offers both fast access and systematic order?
A. Sequential
B. Indexed ✓
C. Random
D. Serial
164. A serial file stores records in order of ___.
A. Key field
B. Arrival ✓
C. Size
D. Date of birth
165. Which of the following is a disadvantage of direct file organization?
A. Slow access
B. Collision may occur ✓
C. Too simple
D. Requires no key
166. Which file type is best for small databases?
A. Sequential ✓
B. Random
C. Indexed
D. Hierarchical
167. Which file organization is ideal when frequent insertions occur?
A. Indexed ✓
B. Sequential
C. Serial
D. Direct
168. An overflow area is used in ___.
A. Sequential
B. Indexed
C. Random ✓
D. Serial
169. The process of converting a key into a storage address is called ___.
A. Mapping ✓
B. Sorting
C. Grouping
D. Scanning
170. Which file organization wastes the most storage?
A. Sequential
B. Indexed
C. Direct ✓
D. Serial
171. A file organized sequentially must first be ___.
A. Indexed
B. Sorted ✓
C. Opened with hashing
D. Encrypted
172. Which is used when records are accessed using a key?
A. Serial
B. Random
C. Direct ✓
D. Chronological
173. Which organization is most suited for student result look-up?
A. Random
B. Sequential
C. Indexed ✓
D. Serial
174. The simplest form of file organization is ___.
A. Sequential
B. Serial ✓
C. Indexed
D. Random
175. In direct organization, two keys generating same address is called ___.
A. Clustering
B. Collision ✓
C. Merging
D. Blending
176. Which system requires updating records quickly?
A. Direct file organization ✓
B. Sequential
C. Chronological
D. Indexed
177. To reduce collisions, direct file organization uses ___.
A. Sorting
B. Re-indexing
C. Hashing ✓
D. Scanning
178. A disadvantage of indexed organization is ___.
A. Slow access
B. Large storage requirement ✓
C. Collision
D. No key
179. Which file organization stores records in no particular order?
A. Sequential
B. Serial ✓
C. Indexed
D. Hierarchical
180. Which is the most expensive to maintain?
A. Serial
B. Sequential
C. Direct
D. Indexed ✓

You might also like