Wednesday, March 23, 2011
Today i will show some T-SQL tricks and tips:
1- Delete Clause: Most of us when delete rows from SQL, we are using
delete from TABLE_NAME
you can also
delete TABLE_NAME
it gives the same effect
2- Candidate, Super and Primary keys...
Primary Key (PK): is a single or a set of collection columns that describe(s) unique rows. It enforces unique key plus clustered unique index. Plus any DB Table can have only one PK.
Candidate Key (Unique Key): can be a single or a set of columns that describe(s) uniqueness of data. DB Table can have more than one of them. Note: it allows only one NULL value in the column. Aslo it enforces creating non clustered index on the table.
Super Key: is rarely used. Formaly, it is a set of attributes that describe all relations assigned to the variables where no two distinct rows have the same value set of them. By other meaning the Cadidate Key is a special version of Super Key and the minimal set that uniqely describes a row, while the Super keys all unique keys.
3- ShowPlan_text Option: SQL option allows see the exceution plan for a SQL statement without exceuting it. It shows the constraints, indexes and keys used in the statement. It used like any SQL option:
set ShowPlan_text on
Hope that being helpful for you.
Labels: SQL
0 comments :
Post a Comment