Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL - notes and maybe one wrong answer #6513

Open
1 task done
mmm4m5m opened this issue Oct 16, 2023 · 5 comments
Open
1 task done

MySQL - notes and maybe one wrong answer #6513

mmm4m5m opened this issue Oct 16, 2023 · 5 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mmm4m5m
Copy link

mmm4m5m commented Oct 16, 2023

I'm submitting an ISSUE: please check one with "x"

  • Missed questions/answers

Q7 and Q114 - duplicate questions
Q14 and Q90 - duplicate questions
Q100, Q104, Q105 - similar questions


Q115 - looks like the answer should be (1) GROUP_BY


Q97. Why would you use stored FUNCTIONS?
[ ] 1 for formulas and business rules that you want to apply to columns in an SQL query
[x] 2 for formulas and business rules that should be applied on a specific trigger event like on inserts

I wonder why (2) is the correct answer? Why not answer (1)?
It is about functions. In the trigger I have all the data and I do not need to pass function parameters, I can use a procedure in that case.

@chandni3496chandni34
Copy link

Option 1: Stored Functions for Formulas and Business Rules in Queries

Imagine you're working with a lot of information in a database. Sometimes, you want to do the same kind of calculation or operation on different pieces of that information. A stored function is like a special tool you can create. You tell it how to do a specific job, and then you can use it over and over again on different parts of the data.

Option 2: Stored Functions in Trigger Events

Now, think of a trigger as a kind of alarm in your database. It goes off when something important happens, like when a new piece of information is added (inserted). When this happens, you might want to do some special tasks right at that moment. A stored function can be like a helper that knows how to do those tasks. It doesn't need extra instructions because it already knows what to do with the information that triggered the alarm.

So, both options are like tools in a toolbox. One is good for doing the same task on different data, and the other is good for doing specific tasks when something important happens. They're just used in different situations, but they're both very handy!

@haxkd haxkd mentioned this issue Oct 17, 2023
3 tasks
@haxkd
Copy link
Contributor

haxkd commented Oct 18, 2023

@mmm4m5m @Ebazhanov closed this issue as complete by the PR #6517

@Ebazhanov Ebazhanov added help wanted Extra attention is needed good first issue Good for newcomers labels Oct 19, 2023
@HimanshuMahto
Copy link
Contributor

hey can you assign me this issue, Would love to work on it.

@haxkd
Copy link
Contributor

haxkd commented Oct 22, 2023

@HimanshuMahto you can start contributing just making PR

@HimanshuMahto
Copy link
Contributor

Made the PR please do check it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants