Jump to content

need HELP with SQL practice tutorials


Recommended Posts

Posted

[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 ba
koddi ga clue ivvu am very new to it ba assalu strike avvatlee
sCo_^Y

  • Replies 117
  • Created
  • Last Reply

Top Posters In This Topic

  • chowdary10

    42

  • boring

    12

  • Jambhalheart

    11

  • chipanjichiru

    9

Top Posters In This Topic

Posted

wat r stored procedures actually  CITI#H@ CITI#H@

Posted

[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()?

Posted

[quote author=KINDAL link=topic=193762.msg2361833#msg2361833 date=1305615702]
sCo_^Y sCo_^Y ba
koddi 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

Posted

[quote author=boring link=topic=193762.msg2361840#msg2361840 date=1305616105]
row_number()?
[/quote]

yes

Posted

[quote author=boring link=topic=193762.msg2361840#msg2361840 date=1305616105]
row_number()?
[/quote]

query  is

select records where = row  number (5,10) *from table;

is  this ryt  F@!n

Posted

[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 problem


for ex., if you want to watch a movie, you probablu repeat following steps:
1. Find theatre and movie
2. Drive there
3. Buy tickets
4. Watch movie
5. Return home

This is called watchMovie procedure if you have to automate in a database. 

Posted

[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  is

select records where = row  number (5,10) *from table;

is  this ryt  F@!n
[/quote]


Posted

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

Posted

[quote author=KINDAL link=topic=193762.msg2361843#msg2361843 date=1305616262]
query  is

select 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 like

select * 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.

Posted

[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 problem


for ex., if you want to watch a movie, you probablu repeat following steps:
1. Find theatre and movie
2. Drive there
3. Buy tickets
4. Watch movie
5. Return home

This 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 g0ssIp

sorry if i misstook it but i feel lyk i got it infact a sure  F@!n

Posted

[quote author=KINDAL link=topic=193762.msg2361852#msg2361852 date=1305616635]
sCo_^Y so its a general way of writing a command in sql  g0ssIp g0ssIp

sorry 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.

Posted

[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

Posted

[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

Posted

[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...

×
×
  • Create New...