7 hours 36 minutes
I welcome the Module four sequel programming, too.
This is less than five sequel events for moving into sub lesson. 5.3 events won the previous lesson. We define what an event was. We in Stan? She aided in the event and we watched it run. It was an event that ran every second, and we could see that it was correctly running and inserting data into a counter table every second.
And this lesson murders solved a problem we previously solved
procedures and triggers. Now there's gonna be a trade off. The event is going to be
more clearly defined in the easier to read, but it does a little more work than you know. It should have to dio Where is a? The procedure and triggers
was a little more complicated, but
it was more closely confined to the data it specifically needed to change, and the changes were live. So if a trigger executed on an update, we would see the derived change immediately. Now, in this instance, this is going to be a drive table that's created once a day, every day,
so it would be one of those instances where you end up telling the customer or the client that
hey, this table or this report will be available once a day. And if you make changes, you won't see the updates until the next day. I think if you've been in a nightie field, you've seen situations like that.
So let's take a look at what we're doing.
So at the top here I am deleting the count table, which is not necessary for this one.
So I'm making sure the global event scheduler is on. I know it's on from the previous assignment, but I just have that on there just in case I drop the event at the beginning so that I could just re Insan. She ate it and run the script as I'm working through it.
So we create an event maintained manager table.
every one day,
and this starts today
it it we, uh, you know, we followed the keywords or the commands do begin. First thing we do is we delete from managers
so that statement by itself will empty out the manager's table,
and then we insert into managers
the selection statement. Select reports, too,
from classic models dot employees where reports to is not know and group by reports, too.
So essentially, this event empties the table and then re populates the table, and this kind of statement is not very heavy. So even if we had, you know, 10,000 managers it would complete, and probably a second wouldn't be, Ah to she wouldn't put too much strain on the server. And it's only running once a day.
And you could run that at Ah, you know,
midnight if you wanted to,
uh, when users aren't using the system and it would be a pretty lightweight run pretty fast.
that completes this lesson. This was a quick lesson on all we did, is we? Instead, she ate in an event that runs once a day that dumps the table a derive table and then re populates it with current data.
Anyways, this script is
available for download, so feel free to download it and running against your own database and, uh, you know, test it out and see how well it works for you
and ah, that completes this lesson. I hope to see you in the next one. Thank you.
Penetration Testing and Ethical Hacking
The Penetration Testing and Ethical Hacking course prepares students for certifications, like CEH. This course ...
7 CEU/CPE Hours Available
Certificate of Completion Offered
This free course introduces the student to intermediate concepts found in the implementation and application ...
10 CEU/CPE Hours Available
Certificate of Completion Offered