top of page
Search

DAT Blog Post 8

  • daniel-ewers2
  • Jun 20, 2021
  • 2 min read

What Have I Learned?

I learnt about stored procedures and functions this week. A stored procedure is a collection of declarative SQL statements that is kept on the server. Once a CALL statement has been used to construct these statements, they can be called at any time. The CREATE PROCEDURE statement contains these statements. Conditional statements such as IF and CASE statements are the only scripts that may be used inside a stored procedure. Stored procedures have the advantages of reducing network traffic, being simple to maintain, and being secure.


When we have several statements encapsulated within a stored procedure, we can call the stored procedure we send the name of the procedure and the values of the parameters rather than trying to execute multiple SQL statements. Stored procedures are also reusable and can be implemented in many areas of an application. This results in a more consistent database containing less code.


Below we can see an example of a stored procedure that I created for my game:

ree


Why Have I Learned This?

As previously indicated, rather than attempting to run numerous SQL statements, we may call the stored procedure and pass the name of the procedure and the values of the parameters. Stored procedures are also reusable and can be used across several areas of a program. As a result, the database becomes more consistent and contains less code. This implies that understanding these approaches is beneficial to our learning since it ensures that our code is more polished, with less bloated and duplicated code.



How Have I Learned This?

I have learned this by doing some research into what procedures and functions are and how I implement them into my code. I did some tests on the tables that I have created for my game to see if it works as expected. I got the expected results and am satisfied that I understand how to use them for future tasks.

 
 
 

Comments


Post: Blog2_Post
  • Facebook
  • Twitter
  • LinkedIn

©2021 by Dwewers2021 ~ Blog. Proudly created with Wix.com

bottom of page