null

mysql NULL value in where in CLAUSE

别等时光非礼了梦想. 提交于 2020-04-09 06:20:08
问题 how to deal with NULL value in mysql where in CLAUSE i try like SELECT * FROM mytable WHERE field IN(1,2,3,NULL) it not working only work like : SELECT * FROM mytable WHERE field IN(1,2,3) OR field IS NULL how can i get it work in WHERE IN ? it is possible ? 回答1: As by my understanding you want to pull every record with 1,2,3 and null value. I don't think its possible to put null in the IN operator. Its expects values and null is well.. not a value. So You really have to put the OR with the

Gson的使用和注解

試著忘記壹切 提交于 2020-04-08 12:11:08
目前比较流行的处理json数据的工具是Jackson和Fastjson,只有少数的公司使用Gson(一些公司对外部插件的安全性要求问题,如某些银行),这里对Gson的使用作个记录。 1、引进Gson jar包 <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.8.6</version> </dependency> 2、Gson工具类 Q: 直接Gson gson = new Gson; 也是可以使用的,那为什么要自己写Gson工具类呢? A: 写工具类是为了统一处理一些特殊情况,如null值的处理等。 import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import

Counting null values as unique value

风流意气都作罢 提交于 2020-04-07 14:46:12
问题 I need to count different values on a column, such as: Hours 1 1 2 null null null The result must be: 3 . My query is: select count(distinct hour) from hours; but it returns: 2. I tested also: select count(*) from hours group by hour but it returns three rows: (1) 3 (2) 2 (3) 1 How can I count null values as 1 value and use distinct to avoid count repeated values? I'm learning advanced SQL, they want me these requirements for all the solutions: Try to minimize the number of subqueries you

C# 读取Excel文件代码

╄→гoц情女王★ 提交于 2020-04-07 05:51:03
片段 1 using System.Data.OleDb; ... static void Main() { Application.Run(new Form1()); } private void Form1_Load(object sender, System.EventArgs e) { DataTable myT=ExcelToDataTable("D:/文件/新武昌站点资料.xls","sheet1"); String mystr=myT.Rows[0][0].ToString(); this.textBox1.Text=mystr; } public static DataTable ExcelToDataTable(string strExcelFileName, string strSheetName) { //源的定义 string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + strExcelFileName + ";" + "Extended Properties='Excel 8.0;HDR=NO;IMEX=1';"; //Sql语句 //string strExcel = string.Format("select * from [{0}$]", strSheetName)

初探java.lang.ClassLoader

落花浮王杯 提交于 2020-04-07 05:25:55
一个类加载器是一个负责加载类的对象,给定一个类的二进制名称,类加载器尝试查找或生成组成该类定义的数据信息。典型的是将这个名称转换成文件名称然后从文件系统中读取类文件 每一个类对象包含一个定义它的类加载器。数组类的类对象不是通过类加载器创建;由java runtime时的需要自动创建。对于一个数组类的类加载器,返回与其元素类的加载器相同;若元素类型为基本类型,那么数组类没有类加载器 应用程序实现子类化的类加载器为了扩展jvm动态加载类的方法。类加载器通常通过安全管理表示安全域的方式被使用。 类加载器的类使用一个代理模型搜索类和资源,每一个类加载器的实例都有一个关联的父类加载器,当需要查找一个类or资源,一个类加载器实例将代理其父类加载器在尝试查找到该类or资源之前。JVM内置加载器“bootstrap class loader”,通常作为其他类加载器的父类加载器。 并行的类加载器支持并发加载类并且要求它们的类在初始化的时调用registerAsParallelCapable进行登记。注意,默认通过登记并行的类加载器,它的子类如需要是并行的时,还是需要进行登记。 在环境中的代理模型是不严格分层的。类加载器需要并行能力,否则可能导致死锁,因为类加载器在类加载过程时持有锁。 通常情况下,JVM从一个平台依赖性的本地文件系统加载类。eg在UNIX系统中

sqlLiteDatebase函数参数分析

我与影子孤独终老i 提交于 2020-04-06 22:07:05
1、SQLiteDataBase对象的query()接口: public Cursor query ( String table, String[] columns, String selection, String[] selectionArgs,                                String groupBy, String having, String orderBy, String limit) Query the given table, returning a Cursor over the result set. Parameters table The table name to compile the query against.( 要查询的表名. ) columns A list of which columns to return. Passing null will return all columns, which is discouraged to prevent reading data from storage that isn't going to be used.( 想要显示的列,若为空则返回所有列,不建议设置为空,如果不是返回所有列 ) selection A filter declaring which rows

What does exclamation mark mean before invoking a method in C# 8.0? [duplicate]

冷暖自知 提交于 2020-04-05 12:40:57
问题 This question already has answers here : Postfix ! (exclamation) operator in C# [duplicate] (1 answer) What does null! statement mean? (2 answers) Closed 4 months ago . I have found a code written in C# seemingly version 8.0. In the code, there is an exclamation mark before invoking a method. What does this part of the code mean, and above all, what are its uses? var foo = Entity!.DoSomething(); 回答1: This would be the null forgiving operator. It tells the compiler "this isn't null, trust me",

SQL限定查询

◇◆丶佛笑我妖孽 提交于 2020-04-03 17:06:14
在很多时候并不需要查询所有数据行内容,此时就可以通过WHERE子句筛选要显示的数据行。语法结构: SELECT [DISTINCT] * | 列名称 [别名],列名称 [别名],... FROM 表名称[别名] [WHERE 过滤条件(s)]; 如果要想实现限定查询,那么需要掌握一些列的限定查询的符号,有如下几种: ●关系运算符:>、<、>=、<=、<>(!=) ●逻辑运算符:AND、OR、NOT ●范围运算符:BETWEEN...AND... ●谓词运算符:IN、NOT IN ●空判断:IS NULL、IS NOT NULL ●模糊查询:LIKE 1.关系运算符 范例: 1)要求查询出所有基本工资高于1500的雇员信息 SQL> SELECT * FROM emp WHERE sal>1500; 2)查询Smith的基本信息 SQL> SELECT * FROM emp WHERE ename='SMITH';   在Oracle数据库之中,所有数据需要区分大小写 3)查询职位不是销售人员的雇员编号、姓名、职位 SQL> SELECT empno,ename,job FROM emp WHERE job<>'SALESMAN'; 2.逻辑运算符 范例: 1)查询出工资范围在1500-3000之间的雇员信息 SQL> SELECT * FROM emp WHERE sal>

Getting document as null [#document: null] After parsing XML in java using DocumentBuilder

雨燕双飞 提交于 2020-04-03 04:27:42
问题 After parsing the documengt I am getting null, even though the document contains data. Here is my code, I have set all validations to false. DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(false); // never forget this! domFactory.setCoalescing(false); domFactory.setValidating(false); domFactory.setFeature("http://xml.org/sax/features/namespaces", false); domFactory.setFeature("http://xml.org/sax/features/validation", false); domFactory

Getting document as null [#document: null] After parsing XML in java using DocumentBuilder

雨燕双飞 提交于 2020-04-03 04:25:01
问题 After parsing the documengt I am getting null, even though the document contains data. Here is my code, I have set all validations to false. DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(false); // never forget this! domFactory.setCoalescing(false); domFactory.setValidating(false); domFactory.setFeature("http://xml.org/sax/features/namespaces", false); domFactory.setFeature("http://xml.org/sax/features/validation", false); domFactory