Sql Server Interview Questions and Answers Part 2

By
1.) How to delete a specific record(a Row) from a table in sql server?                  
delete from table_name where column_name =value
Ex.
delete from student where sid=103
2.) How to add a New Column in your Existing table using sql command ?          
alter table table_name add column_name datatype
Ex.
alter table student add saddress varchar(40)

3.) How to change the size of Existing column in a table ?                                            
alter table  table_name  alter column column_name datatype
Ex.
alter table student alter column saddress varchar(80)

4.) How to Drop the Existing column from a table ?                                                        
alter table  table_name  drop column column_name
Ex.
alter table student drop column saddress

5.) Is "INTO" Keyword is optional in insert statement ?                                               
Yes,We can insert the data in table without Into Keyword.

6.) Which keyword is always used for any changes in Database or table ?               
Alter

7.) How to change the column name in a existing table ?                                               

sp_rename 'table_name.oldcolumn_name','NewColumnName','column'
Ex.
sp_rename 'student.sage','s_age','column'

8.) How to change a existing table in sql server using command ?                            
sp_rename ' oldtable_name ',' Newtable_name ','object'
Ex.
sp_rename 'student','student_details','object'

9.) How to check the structure schema of any table in sql server ?                          
sp_help table_name
Ex.
sp_help student

10.) How to delete a table from database permanently ?                                              
Drop table table_name
Ex.
Drop table student

11.) How to remove a column name from a existing table. ?                                        
Alter table table_name drop column column_name
Ex.
Alter table student drop column sage

12.) Is Sql command is case sensitive?                                                                                  
No, We can use small latter or capital latter for any operation.

4 comments:

  1. How can we write insert command without INTO operator...

    ReplyDelete
    Replies
    1. Read Below link...
      http://www.msdotnet.co.in/2014/05/sql-server-interview-questions-and.html

      Delete
  2. How do we make a web browser with tabbed control and the tabbed control should include close button and add new tab button. And how can we add history feature in my web browser.
    Please help me.

    ReplyDelete

Powered by Blogger.