开发者

Need some ideas for MySQL stored procedures, functions and triggers

开发者 https://www.devze.com 2023-03-07 13:34 出处:网络
I have a school assignment to design a database and to include: * 2 stored procedures * 2 开发者_JS百科functions

I have a school assignment to design a database and to include:

* 2 stored procedures
* 2 开发者_JS百科functions
* 2 triggers

While I know how to implement these, I haven't used them IRL and I have a hard time coming up with use-cases.

Any ideas? :-)

(if it helps, my DB design mimics an online bookstore -- e.g. Amazon)


Possible stored procedures:

  • given author, retrieve list of books (or ISBNs).
  • given ISBN, retrieve title and author.

Possible triggers: maintain separate column with lowercased title/author for faster searching. In other words, index those columns, so as to avoid performance killers like select blah from book where to_lower(author) = 'dan brown'. One trigger for insert, another for update.

0

精彩评论

暂无评论...
验证码 换一张
取 消