Friday 3 January 2014

Interview Question Of Sql Queries

1.Insert Data Into Table
insert into tablename values('column value','column value');

2.Update data Into Table
Update tablename set columnname='value' where columnname='value';

3.Delete Data FromTable
Delete from tablename where columnname='value';

4.Select data from table
select * from tablename  if want to access particular column then write select columnname1,columnname2 from tablename

5.Select Last Five Records From Table
select top(5) * from signup(tablename) order by  id(Column name) desc
Column Name data type should be int and its identity specification property should be Yes(In Sql Server)

6.If you want to see the unique record from the column in table
select distinct(column name)  fromtablename

7.Check The No Of Records in a table
select count(*) from tablename

8.Sum the salary column in table
select SUM(column name) from tablename





2 comments: