Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 786177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:59:53+00:00 2026-05-14T20:59:53+00:00

Is it considered crazy to store common SQL queries for my web app in

  • 0

Is it considered crazy to store common SQL queries for my web app in a database for use in execution? Or is that common practice? Or is it impossible?

My thinking is, this way, I avoid hard-coding SQL into my application files, and add another level of abstraction.

Is this crazy? Is this what a stored procedure is? Or is that something else?


EDIT: The below answers are useful as a background for ‘stored procedures’, but didn’t answer my core question: Is a ‘stored procedure’ just when I have a database table that contains queries that can be called? ie, something like this

INDEX | NAME          | QUERY
1     | show_names    | "SELECT names.first, names.last FROM names;"
2     | show_5_cities | "SELECT cities.city FROM cities LIMIT 0,5;"
etc.

Or is there a more complicated mechanism that encompasses the concept of stored procedures? Is my example an actual example of something people do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:59:54+00:00Added an answer on May 14, 2026 at 8:59 pm

    Along with MUG4N’s great reasons on why to use stored procedures, here are three more:

    Security

    You can grant access to your application to execute stored procedures while denying direct table access.

    Think defense in depth. If your app is cracked, then they will be limited to executing ONLY the procedures you have defined. This means things like ‘drop table’ would be explicitly disallowed, unless, of course, you have a procedure to do that.

    Conversely, if your app is cracked and you allow the app to have full access to your sql server, then one of two things will happen. Either your data disappears and/or the cracker easily get’s a copy.


    Unit Testing.
    It’s much easier to unit test your queries if you can hit them directly without having to go through the application itself.


    In Flight Changes:
    If you need to modify a query AFTER you have published your site, it’s much easier to just make a proc change than redeploy code that may have undergone other changes since the last deployment. For example, let’s say you have a page that isn’t performing all that well. After evaluation, you determine that just changing the joins on a query will fix this. Modify the proc and go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 393k
  • Answers 393k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Looks like the problem was in MySQL after all. I… May 15, 2026 at 2:10 am
  • Editorial Team
    Editorial Team added an answer I am not sure about the functional requirement, but why… May 15, 2026 at 2:10 am
  • Editorial Team
    Editorial Team added an answer To be pedantic, the Inputbox will let you type up… May 15, 2026 at 2:10 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.