From Oracle (but works in most SQL DBs):
SELECT LASTNAME, COUNT(*)
FROM STUDENTS
GROUP BY LASTNAME
HAVING COUNT(*) >= 3
P.S. it’s faster one, because you have no Select withing Select methods here
More Related Contents:
- SQL query for salary in emp table
- SQL Combine two rows into one
- SQL Server Subquery a
- Not equal != operator on NULL
- SET NOCOUNT ON usage
- Oracle: how to UPSERT (update or insert into a table?)
- How can I get column names from a table in SQL Server?
- Copy tables from one database to another in SQL Server
- error, string or binary data would be truncated when trying to insert
- What exactly do quotation marks around the table name do?
- How can I get column names from a table in Oracle?
- What mysql database tables and relationships would support a Q&A survey with conditional questions? [closed]
- Delete column from SQLite table
- sqlite database default time value ‘now’
- MySQL remove duplicates from big database quick
- @@IDENTITY, SCOPE_IDENTITY(), OUTPUT and other methods of retrieving last identity
- Is it possible to run native sql with entity framework?
- What are views good for?
- SQLite auto-increment non-primary key field
- T-SQL – Aliasing using “=” versus “as” [closed]
- How to install localdb separately?
- How to escape square brackets inside square brackets for field name
- The object ‘DF__*’ is dependent on column ‘*’ – Changing int to double
- Retrieve column names and types of a stored procedure? [duplicate]
- Generate DEFAULT values in a CTE UPSERT using PostgreSQL 9.3
- The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions
- COALESCE Function in TSQL
- Row Rank in a MySQL View
- Select Rows with Maximum Column Value group by Another Column
- Is there a postgres CLOSEST operator?