Skip to content
Advertisement

Tag: mysql

Slow sql statement when using variables

I have the following SQL statement running against a MariaDB 10.1.26 with ~2.000 rows with instant results. When I use the following statement with variables for the datetime fields, the execution takes ~5.5 seconds. The more data rows I have, the longer it takes to execute the statement. Seems like the variables change the behaviour of the statement somehow. What’s

sql group by – curse and blessing

I have 3 tables for a meal calculation. Now I like to find a meal by ingredient: Which give me a list like: Also I like to find meal by price like: Which give me a list like: Now let me build a query like Which gives me a list like: Because (i.price / i.minamount * r.quanitity) for this meal

sequelize compare date with date-timestamp

my simple use case is I pass a date and try to compare that with the default createdAt column. and my date is a string like this date = ‘2018-12-12’ The problem here is sequlize not compare only the date. But it does add time 00:00:00 to my date and then compare. So the query sequlize generate is like this.

Is escaping SQL queries like this safe?

I am currently working on a NodeJS backend script that parses incoming HTTP requests to write to and read from a MySQL database for work. I tried to protect it against SQL injections by using a kind of two-layer protection. To write to the database the user needs to provide valid JSON. This is how the JSON’s keys need to

Advertisement