I'm an IT student. I want to know more about database.
so, please help me.as beginning let me give you a question :
by using the following table structure shown like this:
stud_course(studId,corseNo,courseTitle,crhr)
Write a trigger to prevent insertion of record at a point where the total sum of credits taken by the student exceeds 144 credit hours.
Very Usefull information about Database Triggers.
Beofre Reading This ARTICLE I were did't have any Info about Database Trigger But Now I have Created many more and Complicated and Complex Triggers after reading this article.
Thanks to the Great Instructor.
DELIMITER $$
DROP PROCEDURE IF EXISTS dcb_collect_interest$$
CREATE PROCEDURE dcb_collect_interest()
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE interest1 DOUBLE;
DECLARE lref VARCHAR(30);
DECLARE cur1 CURSOR FOR
--- if i run this select stat i ll get output---
select iterestrate,loanref from loan where loanref in (select loanaccno from month_dcb where month1=2 and year1=2012);
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN cur1;
START TRANSACTION;
read_loop: LOOP
FETCH cur1 INTO interest1, lref;
IF done THEN
LEAVE read_loop;
END IF;
-- here no updation ---0 rows affected
update month_dcb
set interest=interest1
where loanaccno=lref and year1=2012 and month1=2;
END LOOP;
COMMIT;
CLOSE cur1;
END;
In this example
"mysql> CREATE TRIGGER ins_trig BEFORE INSERT ON Emp
-> FOR EACH ROW
-> BEGIN
-> UPDATE Employee SET Salary=Salary-300 WHERE Perks>500;
-> END;
-> //
Query OK, 0 rows affected (0.01 sec)
mysql> delimiter ;
mysql> INSERT INTO Emp VALUES(9,'Rajesh','Delhi','Developer',15000,658);"
what happens to 9th row which is being inserted?
Hi Buddies,
Well now we have a handy reference of SQL in android market named SQL guru for free .......go through tweaks in the tips and walkthroughs given.....its pretty cool.
https://play.google.com/store/apps/details?id=com.dopdroid.mysqlguru
I am trying this program of setting salary 10000 if salary<=500 and 15000 if salary>500. when i am fireing the trigger it get executed but after updating the salary SET to 500.all the salary is setting to 500.that means trigger is not workinng.why this happend..please reply...
CongratulatePradeep Kumar Singh August 31, 2012 at 5:29 PM
Hi,
Congratulates to giving the so simple example the clear description.
VERY GOOD EXAMPLES CLEAR PRACTICAL EXPLANATION.
THANK YOU FOR THIS.PLEASE FORWARD THIS TYPE CLEAR EXPLANATION EXAMPLES TO MY EMAIL FROM BASIC ONWARDS.PLEASE FORWARD THANK YOU.
triggers veeranagu April 14, 2011 at 9:54 AM
Hello Sir, This is veeranagu from banagalore.
triggerNaresh June 27, 2011 at 1:06 PM
its very good
advanced database systemmuhammed seid October 28, 2011 at 1:53 PM
I always appreciate you.please continue improving your service to the World.......
advanced database systemmuhammed seid October 28, 2011 at 2:07 PM
I'm an IT student. I want to know more about database. so, please help me.as beginning let me give you a question : by using the following table structure shown like this: stud_course(studId,corseNo,courseTitle,crhr) Write a trigger to prevent insertion of record at a point where the total sum of credits taken by the student exceeds 144 credit hours.
java,oracle,j2eekarthikeyan p November 7, 2011 at 5:42 PM
goood
triggeranu December 20, 2011 at 10:13 PM
why we are using triger and what is the usage?
Database TriggersGhulam Yassen January 14, 2012 at 5:29 PM
Very Usefull information about Database Triggers. Beofre Reading This ARTICLE I were did't have any Info about Database Trigger But Now I have Created many more and Complicated and Complex Triggers after reading this article. Thanks to the Great Instructor.
trigger statementmohan.o February 9, 2012 at 12:52 PM
please send me a trigger statement with best example and also a cursor and view concept.......................
query is not runningindhumathi March 29, 2012 at 12:21 PM
DELIMITER $$ DROP PROCEDURE IF EXISTS dcb_collect_interest$$ CREATE PROCEDURE dcb_collect_interest() BEGIN DECLARE done INT DEFAULT FALSE; DECLARE interest1 DOUBLE; DECLARE lref VARCHAR(30); DECLARE cur1 CURSOR FOR --- if i run this select stat i ll get output--- select iterestrate,loanref from loan where loanref in (select loanaccno from month_dcb where month1=2 and year1=2012); DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN cur1; START TRANSACTION; read_loop: LOOP FETCH cur1 INTO interest1, lref; IF done THEN LEAVE read_loop; END IF; -- here no updation ---0 rows affected update month_dcb set interest=interest1 where loanaccno=lref and year1=2012 and month1=2; END LOOP; COMMIT; CLOSE cur1; END;
mysqlakshath niranjan April 21, 2012 at 9:12 PM
u r examples are excelent
Triggerspranav April 11, 2012 at 1:01 PM
In this example "mysql> CREATE TRIGGER ins_trig BEFORE INSERT ON Emp -> FOR EACH ROW -> BEGIN -> UPDATE Employee SET Salary=Salary-300 WHERE Perks>500; -> END; -> // Query OK, 0 rows affected (0.01 sec) mysql> delimiter ; mysql> INSERT INTO Emp VALUES(9,'Rajesh','Delhi','Developer',15000,658);" what happens to 9th row which is being inserted?
plz correct the materialsachin Thapa May 19, 2012 at 10:23 AM
in the above material you are using emp as insert table and employee as the dispay table. Please use only one name
experienceSIVA R August 3, 2012 at 10:04 PM
it is very useful and easiest way to learn about trigger... really it is very useful to me.. thank you..
MYSQL TUTORIAL ON ANDROIDdopedroid August 11, 2012 at 10:33 PM
Hi Buddies, Well now we have a handy reference of SQL in android market named SQL guru for free .......go through tweaks in the tips and walkthroughs given.....its pretty cool. https://play.google.com/store/apps/details?id=com.dopdroid.mysqlguru
MY SQL TRIGGERINGSourav Roychowdhury August 13, 2012 at 6:06 PM
I am trying this program of setting salary 10000 if salary<=500 and 15000 if salary>500. when i am fireing the trigger it get executed but after updating the salary SET to 500.all the salary is setting to 500.that means trigger is not workinng.why this happend..please reply...
CongratulatePradeep Kumar Singh August 31, 2012 at 5:29 PM
Hi, Congratulates to giving the so simple example the clear description.
to get triggers for my projectmahipatsinh mori September 8, 2012 at 9:34 AM
i currentlly working on a banking system based on sql so plz recommend me triggers if any idea please...
complimentkamal September 30, 2012 at 11:47 AM
oh really it is very nice and short note on trigger i like it................. a lot of thanx.
PL/SQLmallikharjunarao October 4, 2012 at 9:51 AM
VERY GOOD EXAMPLES CLEAR PRACTICAL EXPLANATION. THANK YOU FOR THIS.PLEASE FORWARD THIS TYPE CLEAR EXPLANATION EXAMPLES TO MY EMAIL FROM BASIC ONWARDS.PLEASE FORWARD THANK YOU.
PHPSarfraz Ali December 12, 2012 at 5:51 PM
this is very useful tutorial,specially for new developer.. i glad to see these tutorial on MYSQL thanks for that
oraclemunna October 23, 2012 at 5:06 PM
how to find 2nd largest salary or element in oracle.
not satisfiedpriya January 3, 2013 at 4:24 PM
not up to the level
about triggerDEEPAK NEHE November 29, 2011 at 3:15 PM
siri want moreinformation on trigeer with some more example of trigger
Post your Comment