摘要:
RT,在oracle中,写SQL时,假设这个字段为STA Char(3),判断这个字段是否为空一般都是这两个:STA = '' or STA is null 但是今天这两种方法失效了,无论是STA = '' 还是STA is null 都无法查询到那笔记录。到数据库一看,该字段的确为空,但是由于这个 阅读全文
摘要:
题目:Write a function to find the longest common prefix string amongst an array of strings. 这题的意思是,求字符串数组中的所有字符串的公共头。 解题思路:由于要求所有字符串的公共头,和求几个整数的公约数一样。我们 阅读全文
摘要:
假设我们有一个Salary 薪水表。这个表的字段分别为:id, name, salary, level 在这个表中,每个人有不同的级别(level)。我们要根据不同的级别统计相同级别员工的薪水总和。 此时我们需要使用group by 来对表格进行分组,然后使用case when 语句来进行判断。 c 阅读全文
摘要:
Oracle中,平时我们排序常用“Order by 列名” 的方式来排序,但是有的时候我们希望这个列中的某些元素排在前面或者后面或者中间的某个位置。 这时我们可以使用Order by case when then方法。 举例:我们希望本部门的领导的名字在前面。 实现的效果是:'zhangsan',' 阅读全文
摘要:
题目: Write a SQL query to get the second highest salary from the Employee table. For example, given the above Employee table, the query should return 2 阅读全文
摘要:
Table: Person Table: Address Write a SQL query for a report that provides the following information for each person in the Person table, regardless if 阅读全文