Hi guys, Today i have a simple question for you & my question is what would be the result of the query-
USE tempdb GO CREATE TABLE #Employee (EmpId INT, NAME VARCHAR(15), Salary INT, Expenses VARCHAR(5)) INSERT INTO #Employee SELECT 1056, 'Viraj', 230000, 5216 UNION SELECT 2095, 'Dheeraj', 98000, 7892 UNION SELECT 7258, 'Raman', 42000, 923 UNION SELECT 6323, 'jay', 12000, 8999 SELECT * FROM #Employee SELECT max(Salary) 'Salarymax', max(Expenses) 'Expensesmax', max(Cast(Salary AS VARCHAR(6))) 'Salary_max', max(Cast(Expenses AS INT)) 'Expenses_max' FROM #Employee -- http://www.stoveglass.net/contribute/3dquickmold-2014-best-price/ http://www.casinobonusjagd.info/xexuzava/ <--Answer for this query DROP TABLE #Employee
Isn’t it a simple question-
If you say, it should be 230000,8999,230000,8999. then it is wrong. You should check your basics.
The answer is 230000,923,98000,8999
Do you know the datatype of salary is int & for expenses it is varchar. In comparison, integers are compared with complete number while string are compared with one by one character.