← All topics

SQL Quiz (200 Questions)

199 exercises10 free
  1. 01What Does SQL Stand For?
    Free
  2. 02Which Part Of SQL Is Primarily Used To Retrieve Data?
    Free
  3. 03SQL Is Programming Language For Storing And Processing Information In?
    Free
  4. 04Which Keyword Begins A Query That Retrieves Data From A Table?
    Free
  5. 05SQL Is Considered What Type Of Language?
    Free
  6. 06Which Of The Following Is A Common Relational Database System?
    Free
  7. 07Which Keyword Removes Duplicates In A SELECT Statement?
    Free
  8. 08Which Statement Changes Data In A Database?
    Free
  9. 09n SQL, Which Symbol Is Commonly Used As A Wildcard In Strings?
    Free
  10. 10Which Command Is Used To Remove Rows From A Table?
    Free
  11. 11Which Clause Specifies The Source Table(S) In A Query?
    Locked
  12. 12Which Keyword Selects All Columns From A Table?
    Locked
  13. 13To Select A Literal String “Hello”, You Can Write:
    Locked
  14. 14To Rename A Column In The Result Set, Use:
    Locked
  15. 15If You Omit FROM, Selecting From Where Is Possible In Standard SQL?
    Locked
  16. 16To Choose Columns “Name” And “Age” From Table “Persons”:
    Locked
  17. 17A SELECT Statement Without A WHERE Clause Returns:
    Locked
  18. 18To Avoid Specifying A Table Alias, You Can:
    Locked
  19. 19Which Of These Is A Valid SELECT Syntax?
    Locked
  20. 20Using SELECT Without Specifying Columns Returns:
    Locked
  21. 21The WHERE Clause Is Used To:
    Locked
  22. 22To Select Rows Where Age > 18:
    Locked
  23. 23To Match Rows Where Name Starts With ‘A’:
    Locked
  24. 24To Select Rows Where City Is Either ‘Paris’ Or ‘London’:
    Locked
  25. 25The WHERE Clause Is Placed:
    Locked
  26. 26To Find Rows Where Salary Is NOT 5000:
    Locked
  27. 27Which Operator Checks For NULL Values?
    Locked
  28. 28To Exclude Rows With Age = 30:
    Locked
  29. 29To Use A Pattern To Filter Rows Containing ‘Abc’ Anywhere In Name:
    Locked
  30. 30To Filter Rows Where Price Is Between 10 And 20 Inclusive:
    Locked
  31. 31Which Function Returns The Number Of Rows?
    Locked
  32. 32SUM() Function Is Used To:
    Locked
  33. 33MIN() Function Returns:
    Locked
  34. 34MAX() Function Returns:
    Locked
  35. 35AVG() Function Returns:
    Locked
  36. 36COUNT(*) Differs From COUNT(Column) By:
    Locked
  37. 37To Get Total Sales From ‘Orders’ Table With ‘Amount’ Column:
    Locked
  38. 38To Find The Lowest Salary In Employees Table:
    Locked
  39. 39To Count Rows Ignoring NULL In Column ‘Age’:
    Locked
  40. 40Which Function Can Remove Duplicates When Counting Distinct Values?
    Locked
  41. 41GROUP BY Is Used To:
    Locked
  42. 42GROUP BY Must Be Used With:
    Locked
  43. 43HAVING Clause Filters Rows After:
    Locked
  44. 44To Find Total Sales Per Department:
    Locked
  45. 45HAVING Is Used To Filter Groups, For Example Groups With SUM(Sales)>1000:
    Locked
  46. 46If A SELECT Uses GROUP BY, Columns Not Aggregated Must Be:
    Locked
  47. 47Average Salary By Job_title But Only Show Groups With Avg>5000:
    Locked
  48. 48Without GROUP BY, HAVING Acts Like WHERE, But Standard SQL Requires:
    Locked
  49. 49Count Employees Per Department And Only Show Departments With Count>10:
    Locked
  50. 50You Cannot Use HAVING Without What?
    Locked
  51. 51ORDER BY Is Used To:
    Locked
  52. 52By Default ORDER BY Sorts In:
    Locked
  53. 53To Sort By Name Ascending And Age Descending:
    Locked
  54. 54ORDER BY Must Come:
    Locked
  55. 55To Sort By A Column Not In SELECT, Generally:
    Locked
  56. 56To Sort By Multiple Columns, Separate By:
    Locked
  57. 57To Get Alphabetical Order On ‘Name’:
    Locked
  58. 58To Reverse The Sorting Order:
    Locked
  59. 59If No ORDER BY Specified, Order Of Rows Is:
    Locked
  60. 60ORDER BY Can Sort By Column Position Using:
    Locked
  61. 61INNER JOIN Returns:
    Locked
  62. 62LEFT JOIN Returns:
    Locked
  63. 63RIGHT JOIN Returns:
    Locked
  64. 64FULL OUTER JOIN Returns:
    Locked
  65. 65To Join ‘Orders’ And ‘Customers’ Where Orders.cust_id=Customers.id:
    Locked
  66. 66INNER JOIN Is Also Called:
    Locked
  67. 67To Get All Customers Even If They Have No Orders:
    Locked
  68. 68CROSS JOIN Returns:
    Locked
  69. 69To Filter Joined Results, Use Conditions In:
    Locked
  70. 70If You Want All Rows From Both Tables With No Match Replaced By NULLs:
    Locked
  71. 71A Subquery Is:
    Locked
  72. 72Subqueries Are Often Used In:
    Locked
  73. 73A Scalar Subquery Returns:
    Locked
  74. 74To Find Rows With Value Greater Than The Average, Use:
    Locked
  75. 75A Derived Table Is A Subquery Used:
    Locked
  76. 76A Subquery Returning Multiple Values Can Be Used With:
    Locked
  77. 77Correlated Subqueries:
    Locked
  78. 78To Use A Subquery As A Column List:
    Locked
  79. 79Subqueries Can Appear In:
    Locked
  80. 80A Derived Table Must Have:
    Locked
  81. 81UNION Combines:
    Locked
  82. 82UNION Requires:
    Locked
  83. 83UNION By Default Removes Duplicates. To Keep Duplicates Use:
    Locked
  84. 84INTERSECT Returns:
    Locked
  85. 85EXCEPT Returns:
    Locked
  86. 86Set Operations Typically Require:
    Locked
  87. 87UNION ALL Vs UNION Differs By:
    Locked
  88. 88INTERSECT And EXCEPT Might Not Be Supported By All SQL Dialects. A Common Replacement For INTERSECT Is:
    Locked
  89. 89Set Operators Combine Results Of Multiple SELECTs. The Correct Syntax Usually Is:
    Locked
  90. 90EXCEPT Is Sometimes Known As:
    Locked
  91. 91CREATE TABLE Is Used To:
    Locked
  92. 92B. Removes table structure and data
    Locked
  93. 93ALTER TABLE Is Used To:
    Locked
  94. 94To Remove A Column From A Table:
    Locked
  95. 95CREATE TABLE Syntax Generally Includes:
    Locked
  96. 96To Rename A Table:
    Locked
  97. 97To Add A New Column:
    Locked
  98. 98DDL Statements Like CREATE, DROP, ALTER Usually:
    Locked
  99. 99To Completely Remove A Table And Its Data:
    Locked
  100. 100To Remove All Rows But Keep Table Structure:
    Locked
  101. 101INSERT Is Used To:
    Locked
  102. 102UPDATE Changes:
    Locked
  103. 103DELETE Removes:
    Locked
  104. 104INSERT INTO Table (Col1, Col2) VALUES (Val1, Val2):
    Locked
  105. 105To Update A Row’s Salary In Employees:
    Locked
  106. 106DELETE FROM Table WHERE Condition:
    Locked
  107. 107To Insert Multiple Rows At Once (Some Dialects Allow):
    Locked
  108. 108Without WHERE In UPDATE Or DELETE:
    Locked
  109. 109INSERT Can Be Combined With SELECT To:
    Locked
  110. 110TRUNCATE TABLE Differs From DELETE Because:
    Locked
  111. 111PRIMARY KEY Ensures:
    Locked
  112. 112FOREIGN KEY Enforces:
    Locked
  113. 113UNIQUE Constraint Ensures:
    Locked
  114. 114NOT NULL Ensures:
    Locked
  115. 115CHECK Constraint Allows:
    Locked
  116. 116A Table Can Have How Many PRIMARY KEY Constraints?:
    Locked
  117. 117FOREIGN KEY References:
    Locked
  118. 118UNIQUE Differs From PRIMARY KEY In That:
    Locked
  119. 119To Ensure Age > 0 In A Column, Use:
    Locked
  120. 120Constraints Are Defined Usually In:
    Locked
  121. 121A VIEW Is:
    Locked
  122. 122CREATE VIEW Syntax Includes:
    Locked
  123. 123A MATERIALIZED VIEW Is:
    Locked
  124. 124Views Can Be Used To:
    Locked
  125. 125To Refresh A Materialized View (In Systems That Support It):
    Locked
  126. 126Dropping A View:
    Locked
  127. 127Some Views Are Updatable If:
    Locked
  128. 128A View Does Not Physically Store Data Except:
    Locked
  129. 129To Ensure View Runs A Complex Query Efficiently Without Recalculating Each Time, Use:
    Locked
  130. 130Views Can Be Used For Security By:
    Locked
  131. 131An Index Is Used To:
    Locked
  132. 132A Primary Key Usually Creates:
    Locked
  133. 133Adding Too Many Indexes Can:
    Locked
  134. 134A Clustered Index:
    Locked
  135. 135Non-Clustered Index Stores:
    Locked
  136. 136To Analyze Query Performance, One Might Use:
    Locked
  137. 137Indexes Help SELECT Queries But Can Slow Down:
    Locked
  138. 138A Good Candidate For Indexing Is:
    Locked
  139. 139Removing Unused Indexes Can:
    Locked
  140. 140Indexes Are Created By:
    Locked
  141. 141A Window Function Is Defined Using:
    Locked
  142. 142Window Functions Allow Calculations:
    Locked
  143. 143PARTITION BY In Window Functions:
    Locked
  144. 144ROW_NUMBER() Function:
    Locked
  145. 145RANK() Vs ROW_NUMBER():
    Locked
  146. 146LAG() And LEAD() Functions Allow:
    Locked
  147. 147NTILE(N) Divides Rows Into:
    Locked
  148. 148To Use Window Functions, OVER Clause Is Mandatory Because:
    Locked
  149. 149Window Functions Do Not Collapse Rows Like GROUP BY. They:
    Locked
  150. 150ORDER BY Inside OVER(…) Defines:
    Locked
  151. 151A CTE Starts With:
    Locked
  152. 152A CTE Is Defined For:
    Locked
  153. 153CTEs Can Be Used To:
    Locked
  154. 154A CTE Resembles A Derived Table, But:
    Locked
  155. 155Recursive CTEs Allow:
    Locked
  156. 156Syntax Of A Basic CTE:
    Locked
  157. 158CTEs Are Not Stored Persistently; They Are:
    Locked
  158. 159Recursive CTEs Need:
    Locked
  159. 160CTEs Improve Readability Compared To:
    Locked
  160. 161String Functions Like LENGTH() Or CHAR_LENGTH() Return:
    Locked
  161. 162SUBSTRING(String, Start, Length) Extracts:
    Locked
  162. 163UPPER() And LOWER() Functions Change String Case To:
    Locked
  163. 164Date Functions Like NOW() Or CURRENT_DATE():
    Locked
  164. 165EXTRACT(YEAR FROM Date) Returns:
    Locked
  165. 166DATEADD Or ADD_MONTHS Are Used To:
    Locked
  166. 167CASE Expression Allows:
    Locked
  167. 168CASE WHEN Condition THEN Value ELSE Other END:
    Locked
  168. 169String Functions Like CONCAT(S1,S2):
    Locked
  169. 170COALESCE(Expr1, Expr2, …) Returns:
    Locked
  170. 171A Stored Procedure Is:
    Locked
  171. 172A Stored Function Differs From A Procedure By:
    Locked
  172. 173CREATE PROCEDURE Syntax Varies By Dialect, But Generally Includes:
    Locked
  173. 174Stored Procedures Can Improve Performance By:
    Locked
  174. 175Functions Are Often Used In SELECT Statements Because:
    Locked
  175. 176Stored Procedures Can Accept IN, OUT Parameters To:
    Locked
  176. 177In PL/SQL Or T-SQL, You Can Write:
    Locked
  177. 178To Drop A Stored Procedure:
    Locked
  178. 179Stored Functions Must:
    Locked
  179. 180Procedures And Functions Enhance:
    Locked
  180. 181A Transaction Is:
    Locked
  181. 182COMMIT Saves Changes Made During A Transaction:
    Locked
  182. 183ROLLBACK Undoes:
    Locked
  183. 184BEGIN Or START TRANSACTION Begins:
    Locked
  184. 185Isolation Levels Define:
    Locked
  185. 186A Common Isolation Level Is:
    Locked
  186. 187Locking Is Used To Prevent:
    Locked
  187. 188Deadlocks Occur When:
    Locked
  188. 189COMMIT Ends A Transaction And Makes Changes:
    Locked
  189. 190SAVEPOINT Allows:
    Locked
  190. 191Partitioning A Table Means:
    Locked
  191. 192Horizontal Partitioning Splits Data By:
    Locked
  192. 193Vertical Partitioning Splits Data By:
    Locked
  193. 194Sharding Is A Form Of Partitioning Where:
    Locked
  194. 195Caching Query Results In Memory Can:
    Locked
  195. 196vertical Partitioning Splits Data By:
    Locked
  196. 197Table Partitioning Can Improve Performance By:
    Locked
  197. 198Parallel Query Execution Means:
    Locked
  198. 199Compression In Databases Can:
    Locked
  199. 200Advanced Partitioning Strategies And Indexing Can Lead To:
    Locked