1、select from tb_reader tr where trlength>3; 这里面偷懒,用代替了字段,需要哪些字段,自己添加吧
2、select trreaderid,trreadername,sum(tbbookid) from tb_reader tr join tb_bookdet tb on tbbookcode = trbookcode group by trreaderid,trreadername ;
3、select trreadername from tb_reader tr where exists (select 1 from tb_bookdet tb where trtbbookcode = trbookcode and tbstatus ='借出');
4、create view view_bookinfo as select tbibookid, tbibookname, tbiauthor, tbipublisher from tb_reader tr
join tb_bookdet tb on tbbookcode = trbookcode
join tb_bookinfo tbi on tbbookid = tbibookid
where trbackdate > sysdate and trbackdate - sysdate <10;
5、create nonclustered index INDEX_DEPARTMENT tb_reader(department);---创建索引,department该字段非空、且不重复。
alter table tb_reader add primary key nonclustered(department); ----修改索引
select into dept1 from department 的意思是复制表department的结构和内容,把结构和内容存到新表dept1,要这样 *** 作需要数据库里面没有表dept1,你要导入dept1的结构和内容到department,语句:
select into department from dept1
以上就是关于SQL 数据库的若干问题全部的内容,包括:SQL 数据库的若干问题、我在SQL查询分析器中输入select * into dept1 from department、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)