SQL Notes
System Functions
24/05/2011 13:29
/* 1. System Function -- Built in function like
a.String Functions
b.Mathamatical Functions
c.Date Functions
2. User Defined...
System Objects
24/05/2011 13:28
--System Objects OPERATIONS :-
SELECT * FROM SYSOBJECTS
WHERE xtype='U' -- show the user defined tables
SELECT * FROM SYSOBJECTS
WHERE xtype='P' -- show the user defined Procedures
SELECT * FROM SYSOBJECTS
WHERE xtype='F' -- show the user...
SELECT Operatings
24/05/2011 13:27
--SELECT OPERATIONS :-
--Select operations are used to fetch the values from the table in diff format :-
SELECT *
FROM dbo.TblEmpDetails with (NOLOCK)
SELECT 'EmpID is :' + EmpId +'sss',EmpName,Address,DOB
FROM dbo.TblEmpDetails with...
Constraint in SQL
24/05/2011 12:49
Constraints:-
1. Primary Key Constraint
2. Unique Key Constraint
3. Foreign Key Constraint
CREATE TABLE TblEmpDetailsPKey
(
EmpId varchar(100),
EmpName ...
Keys in SQL
24/05/2011 12:48
/*Keys:-
------
1. Primary Key
2. Unique Key
3. Foreign Key
4. Composite Key
5. Alternate Key
-----------------------------------------------------------------
Primary Key :-
1. Primary is used to create the identical data in a table.
2. It wont allow duplicate Data or repeated data.
3. It wont...
DML-Data Manipulation Language
24/05/2011 12:47
SELECT *
FROM dbo.TblEmpDetails(nolock)
SELECT *
FROM dbo.TblEmpDetails(nolock)
WHERE EMPID='EMP100'
SELECT EmpId,EmpName,Address,Age
FROM ...
DDL-Data Definition Language
24/05/2011 12:45
--DDL : Data Definition Language :-
--New DataBase Creation :-
/*please ensure we are in master Database while creating new database.*/
USE MASTER
CREATE DATABASE KCTSHAN
USE KCTSHAN
-------------------------------------------------------------------------------------------------
--To Form...