Anonymous Asked in Cars &Transportation · 2 weeks ago

How can I get max value in SQL without using max function?

Yes. You can do that as: select MIN(-1 * col)*-1 as col from tableName; Alternatively you can use the LIMIT clause if your database supports it. 12 нояб. 2011 г.


How do you find maximum value in SQL?

To find the max value of a column, use the MAX() aggregate function; it takes as its argument the name of the column for which you want to find the maximum value. If you have not specified any other columns in the SELECT clause, the maximum will be calculated for all records in the table.

Can we use Max in SQL without group by?

Yes your approach is OK, but my example was very simple (compared to my real case). In reality the procedure is much more bigger, and I have to make aggregate function on more than one column (not only on emp_id). Moreover, I am requested to deliver Max/Min values for some columns (so order by can not be the solution).

How do you show max and min in SQL?

To ask SQL Server about the minimum and maximum values in a column, we use the following syntax: SELECT MIN(column_name) FROM table_name; SELECT MAX(column_name) FROM table_name; When we use this syntax, SQL Server returns a single value. Thus, we can consider the MIN() and MAX() functions Scalar-Valued Functions.

How do I find max in MySQL?

MAX() – Find the Maximum Value in a Column in MySQL1Syntax. The syntax of MAX() goes like this: MAX([DISTINCT] expr) [over_clause] ... 2Basic Example. ... 3The GROUP BY Clause. ... 4The ORDER BY Clause. ... 5Find the Maximum Character Length. ... 6Using an OVER Clause.

Related Questions

Relevance
Write us your question, the answer will be received in 24 hours