SQL :
SQL - Structured Query Language..
SQL Mainly Use Data & Information are Stored ..
DataBase :
DataBase is a Collection Of Tables..
Table :
Tables are COllection Of Rows and Columns..
2 type Languages
DDL - Data Defination Language
DML - Data Manipulation Language
DDL Statements :
* CREATE
* ALTER
* DROP
DCL Statements :
* INSERT
* UPDATE
* DELETE
* SELECT
SQL Constraints :
PRIMARY KEY
NOT NULL
CHECK
UNIQUE
FOREIGN KEY
DEFAULT
SQL Data Types :
Int
Varchar(size)
Float
Decimal
Single
Double
DateTime
Identity
Primary Key :
Not Accepted Null Values..
Not Accepted Duplicate Values..
One Table One Primary Only Use..
UNIQUE Key :
(Same as Primary Key)
But Is Accepted One Null Value..
One Table More then Unique Keys are Use..
FOREIGN Key:
One Table to Another Table Refrences to Use ForeignKey..
One Table PrimaryKey to Another Table Called as Reference Key..
SQL Objects :
* Tables
* Stored Procedure
* Function
* Trigger
* Cursor
* Index
* View
Stored Procedure :
Reusability ..
PreCompailed ..
Set Of Querys ..
Perfomance Fast ..
Less Traffic ..
Security Of Your Data..
Function :
Function 2 Types..
* Aggregate Functions
* Scalar Functions
Aggregate Functions :
MAX()
MIN()
COUNT()
AVG()
SUM()
FIRST()
LAST()
Scalar Functions :
UCASE()
LCASE()
NOW()
LENGTH()
Trigger :
Insert,UpDate,Delete Get Excuted automatically Trigger is Called..
INDEX :
Index Is a Book..(Book Index First Page)..
table Columns Create INDEX..
Performance Fast..
Types:
Clusted Index
Non-Clusted Index
View :
View Is a Set Of Select Query ..
Delete Truncate:
Delete Where Condition Use..
Truncate are Not Use for any Conditions..
Delete Row By Row Delete
Truncate Table Delete
Delete Identity Column Not Reset..
Truncate Identity Column Reset..
Delete Trigger Fired..
Truncate Cannot Trigger Fired ..
Delete is Slowly Record Delete..
Truncate is Quickly Delete..
Delete Can Roolback..
Telete Cannot Roolback..
Syntax :
DataBase:
Create DataBase DataBaseName;
Use DataBase DataBaseName;
Create DataBase Vijay_DB;
Use DataBase Vijay_DB
Table
Create Table TableName
(
ColumnName DataTypes,
Name Varchar(250),
...,
...
)
Create Table Actor_Details
(
Act_ID Int,
Act_Name Varchar(100),
Act_Salary Decimal(10,2)
)
Insert :
Insert Into TableName (ColumnName1,ColumnName2,..... )
Values('aaa','aaa')
Insert Into Actor_Details(Act_Name,Act_ Salary)
Values('Ajith',10000)
Selecct :
Select * From TableName;
Select * From Actor_Details;