SQL Level2
SQL Level2
Stored procedures are used to group one or more transact-sql-tatemants (insert select …)
Stored è it will sord into db and it wil be a one of object that made thes db
DELIMITER ;
SQL SERVER
Thes procedure are stocked in the file hase name
1èprogramabilty
2èsotored procedure
MYSQL ROUTINESS
èwhen I want to excute or call the procedure I use
Mysql : call showdata()
Sql server :excute showsata
Stored procedure paramerts
DELEMITER $$
Create procedure procedure_name( @var_name var_type)
BEGEN
//logec
END $$
DELEMITER ;
èreturn value ====> OUTPUT or OUT
è IN
Built in functions :
1. String
functions(upper(),concat(),lower(),substring(),charindex()
,len(),replace()..)
2. Date function
(current_timestamp()datename(),year(),dateadd(),dateYe
ar(),date(),datedif()…)
3. Numeric function (min(),sqrt(),max(),avg()…)
4. System function
Trigger
I. DML trigger
Excute auto matique
Create trigger trigger_name
(After |Before) (insert|Update|DELETE)
On table_name for Each ROW
BEGEN
--variable declarations
--trigger code
END
Raiserror(‘message’16,1)
View ??
Kly premerry : not null – unique
Foreign key :
Create trigger foreign_key