You are on page 1of 5

View (customers--Coutries + Orders)

Logical table based on one or more tables.


Output as new table.

Trigger
Database Object encapsule and define actions
in response INSERT-DELETE-UPDATE operations
exeptions

Runtime error or warning.


we have TRY.. CATCH blocks. RAISEERROR
statements in TRY block ..is an error the control jump to CATCH blocks
RAISEERROR is the command used to generate

temporary tables
Local visible when is a connection, and are deleted when the connection is closed.
Global visible to all users, deleted when the connection is closed.

IDENTITY
column as Auto incremental number or a surrogate key.
We can be defined as a start and increment value
not need to be indexed.

Cluster PK
There can be only one clustered index per table
data rows themselves can be stored in only one order.

Nonclustered
structure separate from the data rows.
Each key value entry has a pointer to the data row that contains the key value.
The pointer is called a row locator.

CONSTRAINT
specify some sort of rules for processing data
limiting the type of data that can go into a table

UNIQUE CONSTRAINT
ensure that all the values in a column are different

HAVING
can be used ONLY WITH SELECT
used in a GROUP BY clause
behaves WHERE clause

JOIN
combine rows from two or more tables
based on a related between them.
sub query
query which can be nested inside a main query
should not have order by clause
should be placed in the right hand side of the comparison operator of the main qry
should be enclosed in parenthesis

COALESCE
return first non-null expression within the arguments.

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

Injection attack?
Use Parameters for Stored Procedures
Filtering input parameters
Use Parameter collection with Dynamic SQL
In like clause, user escape characters

functions
sequence of the statements which accept inputs,
process the inputs then provide the outputs.
Magic Tables
During DML operations like
Insert, Delete, and Update
creates magic tables to hold the values during the DML operations.

Union
combine result of two or more queries into a distinct single result
ALL return all records, not remove duplicated

SUBSTR
return specific portion of string in a given string

CHARINDEX
gives character position in a given specified string.

BCP Bulk Copy


tool can copy a large amount of data to tables and views.
delete duplicate
using CTE and ROW NUMER feature of SQL Server.

PROCEDURES
reduced NETWORK TRAFFCI AND LATENCY
BOOSTING application perfomance
ENCAPSULE LOGIC
CODE REUSE
changing without affecting Client
BETTER SECURITY to your data

index
help speed up searching in the database.
helps in minimizing data comparisons.
improves the performance

Bulkcopy
tool used to copy large amount of data from Tables

primary key and a unique key


PK column whose values uniquely identify every row in a table. never be reused.
They create a clustered index on the column and cannot be null.
UNIQUEidentify every row in a table
create a non-clustered index by default
allows one NULL only.

varchar and nvarchar


nvarhcar can be used to store Unicode characters
takes more space when compared with varchar.

CHECK Constraint
limit the values or type of data that can be stored in a column.
They are used to enforce domain integrity.

FOREIGN KEY
used to link two tables

execution plan
graphical way to helps to determine why queries are taking more time to execute.

heap
A heap is a table that does not contain any clustered index or non-clustered index.

Cursor
Asociated with a group of rows.
Can process row individualy.

You might also like