简单查询 [英] Simple Query
问题描述
我有一个表学生喜欢
sname
-----
ram
ram
ram
raj
raj
raj
i需要输出喜欢
sname
-----
ram
raj
ram
raj
ram
raj
这是一个面试问题在IBM中提问
i有一个表学生喜欢
sname
--- -
ram
ram
ram
raj
raj
raj
i需要输出像
sname
-----
ram
raj
ram
raj
ram
raj
这是一个面试问题在IBM
中提问
如果没有其他字段,我可能会为此创建一个临时表。
--- CK
i have a table student like
union all
从学生中选择不同的sname
union all
select distinct学生嗤之以鼻
嗨Vijaybandi,您给出的编码显示以下结果 -
raj
ram
raj
ram
raj
ram
但我想< br $>
ram
raj
ram
raj
ram
raj
你可以解释一下你的查询,我没有得到它。
假设我有这个。 table -
create table sonia(name varchar)
插入sonia值(''A'')
insert into sonia值(''A'')
插入sonia值(''B'')
从sonia中选择名称
从sonia中选择不同的名称
union all
从sonia中选择不同的名称
在这种情况下,此查询显示结果
A
B
A
B
由于表中有三条记录,因此可能如何。
sname
-----
ram
ram
ram
raj
raj
raj
i need the output like
sname
-----
ram
raj
ram
raj
ram
raj
Its a interview question Asked in IBM
i have a table student like
sname
-----
ram
ram
ram
raj
raj
raj
i need the output like
sname
-----
ram
raj
ram
raj
ram
raj
Its a interview question Asked in IBM
If there are no other fields, I might create a temporary table for this one.
--- CK
select distinct sname from student
union all
select distinct sname from student
union all
select distinct sname from student
hi Vijaybandi, coding u have given shows the following result-
raj
ram
raj
ram
raj
ram
But I want
ram
raj
ram
raj
ram
raj
Can u please explain ur Query,i m not getting it.
Suppose I Have the foll. table-
create table sonia(name varchar)
insert into sonia values(''A'')
insert into sonia values(''A'')
insert into sonia values(''B'')
select name from sonia
select distinct name from sonia
union all
select distinct name from sonia
In that case,this query shows result
A
B
A
B
How its possible since there are three records in the table.
这篇关于简单查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!