Monday, 30 September 2013

how to create a primary key in a table

hello friends
today i will tell you how to create a primary key in your table
friends to know any person in any company it is difficult  task to search a particular person
because there are so many person who's name as same name .. suppose you want find a name whose name rakesh sharma
so you wrote following code assume
 select * from employ where name='rakesh sharma'

so you will see so many rakesh sharma there


but you want to see particular rakesh sharma detail who is working with administrative department


so you will write following code:-


select * from employ where desitinationid ='101'

primary key is use to find a particular record with a primary key you record every table identify uniquly


Thank you

i hope u like this post


Friday, 27 September 2013

how to see top 5 records in any table

hello friends
Today i will show you how to see top 5 records of any thing suppose you want to see top 5 person name who got good marks in whose total marks in sequence order

you create a table whose name position which fields have s.no. ,name ,sub1m,sub2maks,total
and there are so many records in your table and you want to see top 5 student
so you will write following query in sql server


select top * 5 from postion


Thank you