• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

question on select

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does a query like this execute:

select * from tablename1, tablename2

tablename1 and tablename2 are two different tables with different schemas.

Adi
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Adi Peyyala:
Does a query like this execute:

select * from tablename1, tablename2

tablename1 and tablename2 are two different tables with different schemas.

Adi



Why didn'y you try this ?

answer is yes !!

If your tablename1 has 10 rows and tablename2 has 5 rows then you will get 50 rows in result with all columns of both table.

Shailesh
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More specifically it's a cross product of two tables.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Srinivasa Raghavan:
More specifically it's a cross product of two tables.



And technically its Cartesian Product. You need join between tables.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use This to select all columns from both tables.
You will have to join the tables on proper columns to avoid cartesian product.

select tablename1.*, tablename2.* from tablename1, tablename2
where tablename1.col1 tablename2.col1;

Let me know.

s choukse
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

select * from tablename1, tablename2
tablename1 and tablename2 are two different tables with different schemas.


if you mean they belong to two different databases then
You cannot do a select on two different schemas.

Hope this clarifies

Thanks
Kareem
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic