Sie sind auf Seite 1von 3

Q1: You need to add one more column named ClientCode in the Client_info

table. You select the master database from the tool menu panel.
Write and execute the SQL statement to accomplish this task.
Answer

ALTER TABLE Client_info


ADD ClientCode int;

Q2: Which of the following is a DDL statement?

INSERT, SELECT, CREATE, UPDATE, DELETE


Ans: CREATE

Q3: Which of the following is a DML statement?

INSERT, SELECT, CREATE, UPDATE, DELETE


Ans: INSERT, SELECT, UPDATE, DELETE

Q4: What is the difference between truncate, drop?

Q5: What is materialized view?

Q6: Mr. Ali has created a database named DSP_Loans. He has created a view
named DSP_vLoans that executes the following tasks:

 Joins 10 tables that include 500,000 records each.


 Performs aggregations on 4 fields.

The view DSP_vLoans created by Ali is frequently used in several reports of


the company. The view is very slow. How he can improve performance of the
view?
Ans: Convert the view DSP_vLoans into an indexed view.
Q7: CTE and TVF stands for

Q8: What is Partitioned View?

Ans: This view is used to join partitioned data horizontally from a set of
member tables across one or more servers. This makes the data appear as if
from one table. A view that joins member tables on the same instance of SQL
Server is a local partitioned view.

Q9: Foreign key constraint

Ans: A foreign key constraint is a relation you set to another table. When a
foreign key constraint is created, then you cannot enter any value which is not
available in the reference table.

Q10: You retrieve data from a SQL Server table using a SELECT statement.
The objective is to retrieve the column named Name but you want to change
the columnname to Client Name. What T-SQL keyword must be used?

Q11: You want to create a query that uses a virtual table that contains a partial
subset of an actual table. You do not want to use a view. What will you use?

Ans: CTE

Q12: The WITH statement used in

Ans: CTE

Q13: You want to create a query that uses SUM function but the result is
arithmetic overflow. How to resolve this issue?

Q14: What are disadvantages (Problems) of using Triggers?

Ans:
 It is easy to view table relationships , constraints, indexes, stored
procedure in database but triggers are difficult to view.
 Triggers execute invisible to client-application application. They are not
visible or can be traced in debugging code.
 It is hard to follow their logic as it they can be fired before or after the
database insert/update happens.
 It is easy to forget about triggers and if there is no documentation it will
be difficult to figure out for new developers for their existence.
 Triggers run every time when the database fields are updated and it is
overhead on system. It makes system run slower.

Q15: What is TABLE HINT?

Ans: If you want to force a query to use a specific index, you should use the
TABLE HINT query hint.

Das könnte Ihnen auch gefallen