发布网友
共3个回答
懂视网
select app_id,app_secret from wx_ticket group by app_id;
查询出的数据是
app_id | expires_in
--------------------+------------
wxeeccdf2d435d10 | 7200
wxeeccdf2d435d10 | 7200
wx9b7bfb5f59df5009 | 7200
wx9b7bfb5f59df5009 | 7200
wx9ae9eecb72227d | 7200
wx9ae9eecb72227d | 7200
当使用select ‘20150429‘ date,app_id,app_secret from wx_ticket group by app_id;
date | app_id | expires_in
----------+--------------------+------------
20150429 | wxeeccdf2d435d10 | 7200
20150429 | wxeeccdf2d435d10 | 7200
20150429 | wx9b7bfb5f59df5009 | 7200
20150429 | wx9b7bfb5f59df5009 | 7200
20150429 | wx9ae9eecb72227d | 7200
20150429 | wx9ae9eecb72227d | 7200
20150429 | wxc01e853c2a2745c9 | 7200
20150429 | wx911d98d37516611c | 7200
sql语句中查询出的数据添加一列,并且添加默认值
标签:
热心网友
你好!
alter
table
t1
add
user_id
varchar(10)
default
'000001'
向表T1添加字段user_id,默认值000001
希望对你有所帮助,望采纳。
热心网友
alter table table1 add col1 int default 0
[code="java"]SELECT (
CASE WHEN account_id= ''
THEN 'empty'
when account_id is null
then 'empty'
ELSE account_id
END
) account_id
FROM account
WHERE account_id = 'XXX' OR account_id ='' OR (account_id is NULL)[/code]
扩展资料:
SQL默认值是数据库对非空字段数据的一种默认数据,当你设置好默认值的时候,字段设置非NULL,但是插入数据的时候没有给出值,数据库自动会使用默认值插入。如果正常插入值,需要手动添加密码,但是如果有大量的字段可以使用默认值,那么语句会显得有点臃肿。设置字段password默认值。
Create table stu(
stuId varchar2(30) primary key,
stuName varchar2(50) not null,
stuSex char(2) check(stuSex in('男','女')) default '男', --oracle中无默认属性?
stuAge Number(2) check(stuAge >1),
stuJg varchar2(30), --籍贯
stuDept varchar2(40));
参考资料来源:百度百科——结构化查询语言