永发信息网

oracle中使用sql语句的时候有的表的名称是stat.user_info,这个stat是什么?

答案:3  悬赏:40  手机版
解决时间 2021-02-01 03:34
  • 提问者网友:孤凫
  • 2021-01-31 14:11
oracle中使用sql语句的时候有的表的名称是stat.user_info,这个stat是什么?为什么在table文件夹找不到user_info这张表?这种类型的表是如何创建的?
最佳答案
  • 五星知识达人网友:woshuo
  • 2021-01-31 14:23
stat指的应该是用户名。
如果你当前登陆的用户不是stat,那么是不会在user_tables表中找到这个表的。
全部回答
  • 1楼网友:雾月
  • 2021-01-31 15:39
--行列互转 --1、行互列 --> --> (roy)生成測試數據 if not object_id('class') is null     drop table class go create table class(     [student] nvarchar(2),     [course] nvarchar(2),     [score] int     ) insert class     select n'张三',n'语文',78 union all     select n'张三',n'数学',87 union all     select n'张三',n'英语',82 union all     select n'张三',n'物理',90 union all     select n'李四',n'语文',65 union all     select n'李四',n'数学',77 union all     select n'李四',n'英语',65 union all     select n'李四',n'物理',85 go --2000方法: --动态: declare @s nvarchar(4000) set @s='' select @s=@s+','+quotename([course])+'=max(case when [course]='+quotename([course],'''')+' then [score] else 0 end)'     from class     group by[course] exec('select [student]'+@s+' from class group by [student]') --生成静态: select [student],     [数学]=max(case     when [course]='数学' then [score] else 0 end),     [物理]=max(case when [course]='物理' then [score] else 0 end),     [英语]=max(case when [course]='英语' then [score] else 0 end),     [语文]=max(case when [course]='语文' then [score] else 0 end)     from class group by [student] go --动态: declare @s nvarchar(4000) select @s=isnull(@s+',','')+quotename([course])     from class     group by[course] exec('select * from class pivot (max([score]) for [course] in('+@s+')) b') --生成静态: select * from class (max([score]) for [course] in([数学],[物理],[英语],[语文]))b   --生成格式: ------------------------------------------------------------------------------------------ go --加上总成绩(学科平均分) --2000方法: --动态: declare @s nvarchar(4000) set @s='' select @s=@s+','+quotename([course])+'=max(case when [course]='+quotename([course],'''')+' then [score] else 0 end)'     from class     group by[course] exec('select [student]'+@s+',[总成绩]=sum([score]) from class group by [student]')--加多一列(学科平均分用avg([score])) --生成动态: select [student],     [数学]=max(case when [course]='数学' then [score] else 0 end),     [物理]=max(case when [course]='物理' then [score] else 0 end),     [英语]=max(case when [course]='英语' then [score] else 0 end),     [语文]=max(case when [course]='语文' then [score] else 0 end),     [总成绩]=sum([score]) --加多一列(学科平均分用avg([score]))     from class     group by [student] go --2005方法: --动态: declare @s nvarchar(4000) select @s=isnull(@s+',','')+quotename([course])     from class group by[course] --isnull(@s+',','') 去掉字符串@s中第一个逗号 exec('select [student],'+@s+',[总成绩] from (select *,[总成绩]=sum([score])over(partition by [student]) from class) a pivot (max([score]) for [course] in('+@s+'))b ') --生成静态: select [student],[数学],[物理],[英语],[语文],[总成绩]     from (         select *,[总成绩]=sum([score])over(partition by [student]) from class     ) a --平均分时用avg([score]) pivot (max([score]) for [course] in([数学],[物理],[英语],[语文]))b --生成格式: go --2、列转行 --> --> (roy)生成測試數據 if not object_id('class') is null     drop table class go create table class(     [student] nvarchar(2),     [数学] int,     [物理] int,     [英语] int,     [语文] int) insert class     select n'李四',77,85,65,65 union all     select n'张三',87,90,82,78 go --2000: --动态: declare @s nvarchar(4000) select @s=isnull(@s+' union all ','')+'select [student],[course]='+quotename(name,'''')--isnull(@s+' union all ','') 去掉字符串@s中第一个union all     +',[score]='+quotename(name)+' from class'     from syscolumns where id=object_id('class') and name not in('student')--排除不转换的列     order by colid exec('select * from ('+@s+')t order by [student],[course]')--增加一个排序 --生成静态: select * from (     select [student],[course]='数学',[score]=[数学] from class union all     select [student],[course]='物理',[score]=[物理] from class union all     select [student],[course]='英语',[score]=[英语] from class union all     select [student],[course]='语文',[score]=[语文] from class     )t order by [student],[course] go --2005: --动态: declare @s nvarchar(4000) select @s=isnull(@s+',','')+quotename(name)     from syscolumns     where id=object_id('class') and name not in('student')     order by colid exec('select student,[course],[score] from class unpivot ([score] for [course] in('+@s+'))b') go select student,[course],[score]     from class unpivot ([score] for [course] in([数学],[物理],[英语],[语文]))b --生成格式:
  • 2楼网友:老鼠爱大米
  • 2021-01-31 15:23
stat.user_info中stat是表空间名称,user_info是表名称,因为这个不是表,是表存放的空间,所以在table找不到,就像你文件aa放在D盘,查找是d:\aa但是你aa里看不到d盘。创建时增加tablespace stat就可以了。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯