Thursday, 7 August 2014

What is diffrence beetween alter and update

Hello friends
Today i will tell you what is difference between alter and update

Update -update is use for updating the records on the table

Alter -alter is use for updating the structure of table suppose you want to add some coloumn in table so you have need to use alter command


Thanks


Saturday, 12 July 2014

How to see data beetween to values

Hello friends

Today i will tell you how to see data between to values


Suppose you create a table Employee where two fields name and salary and you want to see
where salary between 5000 to 10000 and you have so many records



So you have to write following query


Select * from Employee where salary between 5000 and 10000



Thanks

Friday, 27 June 2014

How to see date in sql server

Hello Friends
Today i will tell you how to see the Date in sql server
you have to write following query in sql server


Select GetDate()
Go

Thanks

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

Tuesday, 12 June 2012

How to create a procedure

how to create a procedure in sql server

friends today i will tell you how to create a procedure
syntax of  creating procedure-- create procedure procedure name
Example --suppose you create a table which name is fee and its fields name is name,age,class,city and you want to see only name and city fields in output
you right following query
to create a procedure 
--create procedure ravi
 as begin
select name,city from fee
end
Then you press f5--
To execute store procedure you right following query
exec ravi
Then press f5
Thank you

Tuesday, 5 June 2012

How to create a view in a sql server

How to create a view in a sql server

friends today i will tell you how to create a view and what is the use of view ..when we fire select statement in a table the query doesn't save but when we create a view the query save in a view folder ....
friend suppose you create a table employee and you want to see data many time and you don't want to write select query in many time the better option is create a view on a table....
syntax-create view view-name statement
example--create view cc select * from employee

Thank you