You are on page 1of 2

View (customers--Coutries + Orders) Cursor PROCEDURES

Logical table based on one or more tables. Asociated with a group of rows. reduced NETWORK TRAFFCI AND LATENCY
Output as new table. Can process row individualy. BOOSTING application perfomance
ENCAPSULE LOGIC
Trigger CODE REUSE
Database Object encapsule and define actions changing without affecting Client
in response INSERT-DELETE-UPDATE operations BETTER SECURITY to your data
exeptions
index
Runtime error or warning. help speed up searching in the database.
we have TRY.. CATCH blocks. RAISEERROR helps in minimizing data comparisons.
statements in TRY block ..is an error the control jump to CATCH blocks improves the performance of the retrieval of the data from the database.
RAISEERROR is the command used to generate

temporary tables Bulkcopy


Local visible when is a connection, and are deleted when the connection is closed. tool used to copy large amount of data from Tables
Global visible to all users, deleted when the connection is closed.

primary key and a unique key


IDENTITY PK column whose values uniquely identify every row in a table. never be reused.
column as Auto incremental number or a surrogate key. They create a clustered index on the column and cannot be null.
We can be defined as a start and increment value UNIQUE identify every row in a table
not need to be indexed. create a non-clustered index by default
allows one NULL only.
Clustered PK
There can be only one clustered index per table varchar and nvarchar
data rows themselves can be stored in only one order. nvarhcar can be used to store Unicode characters
takes more space when compared with varchar.
Nonclustered
structure separate from the data rows. CHECK Constraint
Each key value entry has a pointer to the data row that contains the key value. limit the values or type of data that can be stored in a column.
The pointer is called a row locator. They are used to enforce domain integrity.

CONSTRAINT FOREIGN KEY


specify some sort of rules for processing data used to link two tables
limiting the type of data that can go into a table

UNIQUE CONSTRAINT
ensure that all the values in a column are different
HAVING Union
can be used ONLY WITH SELECT combine result of two or more queries into a distinct single result
used in a GROUP BY clause ALL return all records, not remove duplicated
behaves WHERE clause
SUBSTR
JOIN return specific portion of string in a given string
combine rows from two or more tables based on a related between them.

sub query CHARINDEX


query which can be nested inside a main query gives character position in a given specified string.
should not have order by clause
should be placed in the right hand side of the comparison operator of the main query BCP Bulk Copy
should be enclosed in parenthesis tool can copy a large amount of data to tables and views.

COALESCE delete duplicate


return first non-null expression within the arguments. using CTE and ROW NUMER feature of SQL Server.

@@SPID
returns the session ID of the current user process.

Injection attack? execution plan


Use Parameters for Stored Procedures graphical way to helps to determine why queries are taking more time to execute.
Filtering input parameters
Use Parameter collection with Dynamic SQL heap
In like clause, user escape characters A heap is a table that does not contain any clustered index or non-clustered index.

functions
sequence of the statements which accept inputs, process the inputs to perform some specific task and then provide the outputs.

Magic Tables
During DML operations like Insert, Delete, and Update, SQL Server creates magic tables to hold the values during the DML operations.

You might also like