1.) What is the use of SQL Server Management Studio ?
It is a software which is basically used for store and retrieve the data from the database.
2.) How to change existing database using command in sql server ?
Alter Database olddatabase_name modify Name=NewDatabase
Ex.
Alter Database school modify Name=college
Ex.
Alter Database school modify Name=college
3.) How to update an existing record in a table ?
Update table_name set column1=value,column2=value where column3=value
Ex.
Update student set sname='mithilesh4.) How to Drop the Existing column from a table ?
alter table table_name drop column column_name
Ex.
alter table student drop column saddress',sage=25 where sid=103
Ex.
Update student set sname='mithilesh4.) How to Drop the Existing column from a table ?
alter table table_name drop column column_name
Ex.
alter table student drop column saddress',sage=25 where sid=103
4.) How to delete a row from a table in sql server?
Delete from table_name where column_name =value
Ex.
Delete from student where sid =105
Ex.
Delete from student where sid =105
5.) 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)
Ex.
alter table student add saddress varchar(40)
6.) 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)
Ex.
alter table student alter column saddress varchar(80)
7.) How to Drop the Existing column from a table ?
alter table table_name drop column column_name
Ex.
alter table student drop column saddress
Ex.
alter table student drop column saddress
8.) Is "INTO" Keyword is optional in insert statement ?
Yes,We can insert the data in table without Into Keyword.
9.) Which keyword is always used for any changes in Database or table ?
Alter
10.) 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'
Ex.
sp_rename 'student.sage','s_age','column'
11.) 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'
Ex.
sp_rename 'student','student_details','object'
No comments:
Post a Comment