新入社員TYです。
社内研修になり、3週目となりました。
社内研修では、今月いっぱいで、販売管理システムの構築を行っております。
システムサンプルを用意してもらい、
販売管理システムの構築を行っております。
外部の研修では、Visual BasicやSQL Serverについて学んだのですが、
いざ社内研修となるとまだまだ知らないことが出てきます。
そこで、まだ理解できてストアドプロシージャについて説明したいと思います。
まず、ストアドプロシージャとは、簡単に言うと、
データベース側でデータの取得/操作/更新/削除などの複雑な処理をすることです。
ストアドプロシージャを使う利点なのですが、以下の3つですが挙げられます。
1.Security
-- You can set up access controls on the stored procedure
and that can allow one user to access the stored procedure, instead of
directly to the tables affected. You could the precisely identify what
they should and should not be able to do with the data. By passing your
inserts through a stored procedure, rather than directly to an INSERT statement,
you can catch SQL Injection attacks. While stored procedures aren't your only
line of protection for injection attacks, they can be a key component.
2.Improved Performance
-- If you created a stored procedure to do your search,
rather than a direct query, the optimizer engine can compute an execution plan
and reuse that plan later, rather than having to compute a new plan for each search.
While this doesn't yield a huge ROI until you start talking about tables with hundreds
of thousands of rows, you need to consider scalability when programming against your database.
3.programming standards
-- if you expose your database to your programmers
through stored procedures, you can be sure they are inserting data the same
way each time, updating the same way each time, and deleting the same way each time.
This becomes more important as you use higher forms of normalization, and have
referential integrity between related tables. Using Stored procedures,
you can be sure to insert into the parent table before the child table.
This can save you the hassle of having to build code just to clean up dirty data within your database.
かなりまとまっている説明なのですが、
これは、Quora(https://www.quora.com/)というQ&Aサイトからです。
インターネット関連の最新情報を質問、解答するSNSです。
ふとしたサービスに対する疑問、質問に創業者やそれに関する様々な人が解答してくれます。
話に戻りますが、
まだストアドに関して、わかるようで理解していませんが、
社内研修を通して、徐々にこのような技術的な知識を身につけていきたいと思います。
以上です。