What do you want to save?
Add Code snippet
New code examples
-
SQL 2021-09-28 01:33:04
sql select most frequent value in column
SELECT col, COUNT(col) AS value_occurrence FROM m_table GROUP BY col ORDER BY value_occurrence DESC LIMIT 1; -- Oracle <= 11g SELECT * FROM (SELECT col, COUNT(col) AS value_occurrence FROM m_table GROUP BY col ORDER BY value_occurrence DESC) WHERE row... Add solution -
SQL 2021-09-27 22:42:02
mysql offset from bottom
SELECT id FROM table ORDER BY id DESC LIMIT 5 If you like to select entries 10,9,[8,7,6,5,4],.. try (3 start index, 5 row count) SELECT id FROM table ORDER BY id DESC LIMIT 3,5 Or 1,2,3,[4,5,6,7,8],9,10 SELECT id FROM table ORDER BY id ASC LIMIT 4,5 Add solution -
SQL 2021-09-26 20:48:03
sql limit to 5 results
-- MySql SELECT * FROM emp ORDER BY sal DESC LIMIT 5; -- SQL Server SELECT TOP 5 * FROM emp ORDER BY sal DESC; -- Oracle < 11g SELECT * FROM ( SELECT * FROM emp ORDER BY sal DESC ) WHERE ROWNUM <= 5; -- Oracle 12c + SELECT * FROM emp ORDER BY sa... Add solution -
SQL 2021-09-16 12:02:04
mysql select last 10 rows
SELECT fields FROM table ORDER BY id DESC LIMIT 1; Add solution -
Best helpers
Ranking is empty