select ifnull(null,'replaces the null')
-->replaces the null
select coalesce(null,null,'replaces the null')
-->replaces the null
Run Code Online (Sandbox Code Playgroud)
在这两个条款中,主要区别在于论证传递.对于ifnull它的两个参数和合并2或3我们可以通过,除了这两个之间我们有任何其他区别吗?它在MSSql中有何不同.
在一次采访中我问过这个问题:如果不使用static和main,我们怎样才能在控制台上打印消息?有可能吗?
SELECT person
FROM person
INNER JOIN collectionmember ON sourceobjectid = personid
GROUP BY sourceobjectid
HAVING COUNT(sourceobjectid) > 1;
Run Code Online (Sandbox Code Playgroud)
据说如果我们使用GROUP BY子句,GROUP BY列名必须在SELECT column列表中。但上面的查询无需选择即可工作sourceobjectid。
这个查询是如何工作的?
public static void main(String[] args) throws ParseException {
// create a date
Date date = new Date();
long diff = date.getTime();
Date date1 = new Date(2013, 10, 1, 11, 6);
long diff1 = date1.getTime();
System.out.println("date is 1-10-2013, " + diff + " have passed.");
System.out.println("date is 1-10-2013, " + diff1 + " have passed.");
}
Run Code Online (Sandbox Code Playgroud)
而输出是
date is 1-10-2013, 1380605909318 have passed.
date is 1-10-2013, 61341428160000 have passed.
Run Code Online (Sandbox Code Playgroud)
任何人都能详细说明1380605909318和61341428160000之间的区别吗?