I just read online that MariaDB (which SQLZoo uses), is based on MySQL. So I thought that I can use ROW_NUMBER() function
However, when I try this function in SQLZoo :
SELECT * FROM (
SELECT * FROM route
) TEST7
WHERE ROW_NUMBER() < 10
then I get this error :
Error: FUNCTION gisq.ROW_NUMBER does not exist
Here's the SQL query to select top 10 distinct rows using DISTINCT keyword. mysql> select distinct * from sales limit 10; Hopefully, now you can easily select top N rows in MySQL. Ubiq makes it easy to visualize data in minutes, and monitor in real-time dashboards.
To select first 10 elements from a database using SQL ORDER BY clause with LIMIT 10. Insert some records in the table using insert command. Display all records from the table using select statement. Here is the alternate query to select first 10 elements.
You can use the limit
clause:
SELECT * FROM route LIMIT 10
This can, of course, be used on a sorted query too:
SELECT * FROM route ORDER BY some_field LIMIT 10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With