Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to select the first 5 rows using SQL Server syntax.
SQL
SELECT [1] 5 * FROM Employees;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using LIMIT which is for MySQL/PostgreSQL.
Using FETCH which is part of OFFSET-FETCH syntax.
✗ Incorrect
In SQL Server, TOP is used to limit the number of rows returned.
2fill in blank
mediumComplete the code to select the first 10 rows using MySQL syntax.
SQL
SELECT * FROM Customers [1] 10;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using TOP which is not valid in MySQL.
Placing LIMIT before FROM clause.
✗ Incorrect
In MySQL, LIMIT is used at the end of the query to restrict rows.
3fill in blank
hardFix the error in this PostgreSQL query to limit results to 3 rows.
SQL
SELECT * FROM Orders [1] 3;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using TOP which is for SQL Server.
Using FETCH FIRST without OFFSET.
✗ Incorrect
PostgreSQL uses LIMIT at the end to restrict rows returned.
4fill in blank
hardFill both blanks to select the first 7 rows in Oracle 12c or later.
SQL
SELECT * FROM Products [1] [2] 7 ROWS ONLY;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using LIMIT which is not supported in Oracle.
Using TOP which is for SQL Server.
✗ Incorrect
Oracle 12c+ uses FETCH FIRST n ROWS ONLY to limit rows.
5fill in blank
hardFill all three blanks to select the first 4 rows in Oracle 12c+ with full syntax.
SQL
SELECT * FROM Sales ORDER BY SaleDate [1] [2] 4 [3];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using LIMIT which is not valid in Oracle.
Omitting ROWS ONLY at the end.
✗ Incorrect
Oracle 12c+ uses FETCH FIRST n ROWS ONLY after ORDER BY to limit rows.