chowdary10 Posted May 17, 2011 Author Report Posted May 17, 2011 [quote author=Jambhalheart link=topic=193762.msg2361824#msg2361824 date=1305615396]ok mama...as a task... do this simple one...There is a table A with 20 records... Now , write a query for displaying records from 5 to 10.. I mean from 5th record to 10th record(including)...( neeku Stored procedures vasthe cheppu mama, manchi practise tasks chepthanu.. )[/quote] sCo_^Y sCo_^Y bakoddi ga clue ivvu am very new to it ba assalu strike avvatlee sCo_^Y
chowdary10 Posted May 17, 2011 Author Report Posted May 17, 2011 wat r stored procedures actually CITI#H@ CITI#H@
boring Posted May 17, 2011 Report Posted May 17, 2011 [quote author=Jambhalheart link=topic=193762.msg2361829#msg2361829 date=1305615654]I know lol...but one shuld try doing it in sql server...[/quote]row_number()?
Jambhalheart Posted May 17, 2011 Report Posted May 17, 2011 [quote author=KINDAL link=topic=193762.msg2361833#msg2361833 date=1305615702] sCo_^Y sCo_^Y bakoddi ga clue ivvu am very new to it ba assalu strike avvatlee sCo_^Y[/quote]ok ... u can row_number() function in sql server like this...select row_number() over(order by billid) row,* from bills
Jambhalheart Posted May 17, 2011 Report Posted May 17, 2011 [quote author=boring link=topic=193762.msg2361840#msg2361840 date=1305616105]row_number()?[/quote]yes
chowdary10 Posted May 17, 2011 Author Report Posted May 17, 2011 [quote author=boring link=topic=193762.msg2361840#msg2361840 date=1305616105]row_number()?[/quote]query isselect records where = row number (5,10) *from table;is this ryt F@!n
boring Posted May 17, 2011 Report Posted May 17, 2011 [quote author=KINDAL link=topic=193762.msg2361837#msg2361837 date=1305615794]wat r stored procedures actually CITI#H@ CITI#H@[/quote]a procedure means sequence of steps to follow to perform a task. If its stored in db then its called stored proc.in db world, its set of valid sql statements put together to solve a problemfor ex., if you want to watch a movie, you probablu repeat following steps:1. Find theatre and movie2. Drive there3. Buy tickets4. Watch movie5. Return homeThis is called watchMovie procedure if you have to automate in a database.
chowdary10 Posted May 17, 2011 Author Report Posted May 17, 2011 [quote author=Jambhalheart link=topic=193762.msg2361841#msg2361841 date=1305616210]ok ... u can row_number() function in sql server like this...select row_number() over(order by billid) row,* from bills[/quote] sCo_^Y sCo_^Y is this correst [quote author=KINDAL link=topic=193762.msg2361843#msg2361843 date=1305616262]query isselect records where = row number (5,10) *from table;is this ryt F@!n[/quote]
Jambhalheart Posted May 17, 2011 Report Posted May 17, 2011 ok here is the final query... select * from (select row_number() over(order by billid) row,* from bills) A where row between 5 and 10
boring Posted May 17, 2011 Report Posted May 17, 2011 [quote author=KINDAL link=topic=193762.msg2361843#msg2361843 date=1305616262]query isselect records where = row number (5,10) *from table;is this ryt F@!n[/quote]partially. you need to see what correct SQL translation for above. it might look likeselect * from my_table where row_number() between 5 and 10;OR select * from my_table where row_number() > 4 and row_number() < 11;or your own interpretation of getting people between roll numbers 5 & 10 in your school days. just find the logic and then see what is valid syntax online in sql langauage. then convert your logic to sql.
chowdary10 Posted May 17, 2011 Author Report Posted May 17, 2011 [quote author=boring link=topic=193762.msg2361845#msg2361845 date=1305616356]a procedure means sequence of steps to follow to perform a task. If its stored in db then its called stored proc.in db world, its set of valid sql statements put together to solve a problemfor ex., if you want to watch a movie, you probablu repeat following steps:1. Find theatre and movie2. Drive there3. Buy tickets4. Watch movie5. Return homeThis is called watchMovie procedure if you have to automate in a database. [/quote] sCo_^Y so its a general way of writing a command in sql g0ssIp g0ssIpsorry if i misstook it but i feel lyk i got it infact a sure F@!n
boring Posted May 17, 2011 Report Posted May 17, 2011 [quote author=KINDAL link=topic=193762.msg2361852#msg2361852 date=1305616635] sCo_^Y so its a general way of writing a command in sql g0ssIp g0ssIpsorry if i misstook it but i feel lyk i got it infact a sure F@!n[/quote]i guess in simple words, if you have to type multiple commands to do a task, and you are expected to repeat this task multiple times, then you will combine those steps in a procedure.whenever you have to repeat those commands, you will just type in procedure name. it will execute all the commands written under that procedure.
chowdary10 Posted May 17, 2011 Author Report Posted May 17, 2011 [quote author=Jambhalheart link=topic=193762.msg2361849#msg2361849 date=1305616541]ok here is the final query... select * from (select row_number() over(order by billid) row,* from bills) A where row between 5 and 10[/quote] sCo_^Y sCo_^Y sCo_^Y wat is this command actually called
chowdary10 Posted May 17, 2011 Author Report Posted May 17, 2011 [quote author=boring link=topic=193762.msg2361855#msg2361855 date=1305616842]i guess in simple words, if you have to type multiple commands to do a task, and you are expected to repeat this task multiple times, then you will combine those steps in a procedure.whenever you have to repeat those commands, you will just type in procedure name. it will execute all the commands written under that procedure.[/quote]got it so we need not repeat the entire command... we can just give the procedure name... tats it ryt
Jambhalheart Posted May 17, 2011 Report Posted May 17, 2011 [quote author=KINDAL link=topic=193762.msg2361858#msg2361858 date=1305616866] sCo_^Y sCo_^Y sCo_^Y wat is this command actually called[/quote]actually edi oka subquery mama, in sql server..here we used, alias names, table names ...edi enduke cheppanu ante, neeku koncham idea vasthundi sub queries medha...
Recommended Posts