sql字段不为空时查字典表

sql字段不为空时查字典表,第1张

1、首先需要创建数据库表t_user_info,利用创建表SQL语句create table。

2、向数据库表里插入数据,按照插入SQL语句insert into 执行。

3、插入完毕后,查询数据库表记录select 字段 from table。

4、查询数据库表t_user_info用户地址为空的记录select * from table from 字段 is null。

5、查询数据库表t_user_info用户电话不为空的记录,select * from table where 字段 is not null。

6、查询数据库表t_user_info电话不为空且地址为空的记录,select * from table where 字段 is not null and 字段 is null。

1、Oracle数据库:

select  *  from ‘数据库的名字’  where Table_Name='你要查询表的名字'

2、mysql查询表所有列名,并用逗号分隔:

SELECT GROUP_CONCAT(COLUMN_NAME SEPARATOR ",")

FROM information_schema.COLUMNS

WHERE TABLE_SCHEMA = '数据库的名字' AND TABLE_NAME = '你要查询表的名字'

扩展资料

Oracle数据库其他查询语句:

1、查询所有表名:

select t.table_name from‘数据库的名字’;

2、查询所有字段名:

select t.column_name from ‘数据库的名字’;

3、查询指定表的所有字段名:

select t.column_name from ‘数据库的名字’ where t.table_name = '你要查询表的名字';

4、查询指定表的所有字段名和字段说明:

select t.column_name, t.column_name from‘数据库的名字’where t.table_name = '你要查询表的名字';


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/9982888.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-04
下一篇 2023-05-04

发表评论

登录后才能评论

评论列表(0条)

保存