Jump to content

Calling Database Guru's


Recommended Posts

Posted

[quote name='Silver_mani' timestamp='1339552561' post='1301958930']


adi avasaram ledu mama naaku
[/quote]
he he
ggle la alaane ochindi mama...

  • Replies 70
  • Created
  • Last Reply

Top Posters In This Topic

  • Silver_mani

    30

  • mtkr

    15

  • ChampakDas

    10

  • siri_vennela

    5

Popular Days

Top Posters In This Topic

Posted

[quote name='vissu' timestamp='1339552977' post='1301958953']
> SELECT * FROM SYSCAT.COLUMNS where KeySeq = 1;
[/quote][quote name='mtkr' timestamp='1339553020' post='1301958956']
mama ggle chesthe ivi dorikinaiii db2 ki...


[color=#333333][font=arial][size=3]Primary key [/size][/font][/color]

[color=#333333][font=arial][size=3]SELECT NAME [/size][/font][/color]
[color=#333333][font=arial][size=3]FROM [/size][/font][/color]
[color=#333333][font=arial][size=3]SYSIBM.SYSCOLUMNS [/size][/font][/color]
[color=#333333][font=arial][size=3]WHERE TBNAME = 'table name' [/size][/font][/color]
[color=#333333][font=arial][size=3]AND TBCREATOR = 'creator' [/size][/font][/color]
[color=#333333][font=arial][size=3]AND KEYSEQ > 0 [/size][/font][/color]
[color=#333333][font=arial][size=3]ORDER BY KEYSEQ ASC [/size][/font][/color]

[color=#333333][font=arial][size=3]Foreign Key [/size][/font][/color]

[color=#333333][font=arial][size=3]SELECT B.REFTBNAME AS PARENTTABLE,COLNAME [/size][/font][/color]
[color=#333333][font=arial][size=3]FROM [/size][/font][/color]
[color=#333333][font=arial][size=3]SYSIBM.SYSFOREIGNKEYS A, [/size][/font][/color]
[color=#333333][font=arial][size=3]SYSIBM.SYSRELS B [/size][/font][/color]
[color=#333333][font=arial][size=3]WHERE A.RELNAME = B.RELNAME [/size][/font][/color]
[color=#333333][font=arial][size=3]AND B.TBNAME = 'table name' [/size][/font][/color]
[color=#333333][font=arial][size=3]AND B.REFTBCREATOR = 'creator' [/size][/font][/color]
[color=#333333][font=arial][size=3]AND B.REFTBCREATOR = A.CREATOR [/size][/font][/color]



[color=#333333][font=arial][size=3]select tbname ,pkcolnames,fkcolnames from sysibm.sysrels [/size][/font][/color]
[/quote]

looks good try chesta ...thanks mama CITI_y@R CITI_y@R

Posted

[quote name='Silver_mani' timestamp='1339553134' post='1301958964']
looks good try chesta ...thanks mama CITI_y@R CITI_y@R
[/quote]
S%Hi

Posted

mama inko doubt ? view meeda order by enduku cheyalemu ? correct me if am wrong !

Posted

[quote name='Silver_mani' timestamp='1339554072' post='1301959028']
mama inko doubt ? view meeda order by enduku cheyalemu ? correct me if am wrong !
[/quote]

gud pt mama.... ippude nerchukunnaa...
ya cheyyalemu anta....

Posted

Orderby cannot be applied in the view but should be applied for the definition. That's the whole point behind Views - they are just virtual records obtained from main table. To workout with more options, you can try using CTE, that comes in handy!

Posted

[img]http://gifsoup.com/view4/3520124/kshanam-o.gif[/img]

Posted

[quote name='Silver_mani' timestamp='1339554072' post='1301959028']
mama inko doubt ? view meeda order by enduku cheyalemu ? correct me if am wrong !
[/quote]
i think if weuse TOP u can use order by in view.......... epudo theortical ga nerchukuna correct me also if i am wrong

Posted

In the definition of the view - yes, you can use but not on the view.
[quote name='ghazni' timestamp='1339561555' post='1301959664']
i think if weuse TOP u can use order by in view.......... epudo theortical ga nerchukuna correct me also if i am wrong
[/quote]

Posted

[quote name='ChampakDas' timestamp='1339560185' post='1301959523']
Orderby cannot be applied in the view but should be applied for the definition. That's the whole point behind Views - they are just virtual records obtained from main table. To workout with more options, you can try using CTE, that comes in handy!
[/quote]


gp mama but what;s CTE ? koncham explain cheyyava ?

Posted

CTE - Common table expression. It is just like a view but you can apply whatever operations that you can do on a table like group by order by, pivot, unpivot etc..And, the beauty of CTE is it only lasts for a query and you can reference it multiple times with in that query.

Posted

Confusing ga untey LMK, I will provide the basic skeleton of CTE.

Posted

[quote name='ChampakDas' timestamp='1339564826' post='1301959999']
Confusing ga untey LMK, I will provide the basic skeleton of CTE.
[/quote]


oh great mama ...oka example iste chaala help avutundu ..Thanks in advance _-_ _-_

Posted

ltt for ChampakDas [img]http://lh5.ggpht.com/-ux6UiZkZOaQ/T7UzwDXHbZI/AAAAAAAAGeA/BY_osPDS4-Q/s150/Brahmi-1.gif[/img]

×
×
  • Create New...