Help me please. I need to write two functions, one that calculates the factorial and another that calculates the sums of euler. To make the euler sums I need to use the function that calculates the factory. I already have the function of factorial but when doing the sums the result I get “NULL” Note: it needs to be done
Tag: sql
Using REPLACE with CHAR(160) is Returning Hexadecimal as Value
I am trying to get rid of   characters in MYSQL, but am getting weird behavior where using REPLACE is returning a hexadecimal string. The original value is some HTML stored in a field with the type BLOB: The SQL I am using is this: And after executing, this is what is left in the database: What is going on
How can use lag to return the difference between the value of the current row and the value of the following row?
I would like to ask you how to return the difference between the value of the current row and the value of the following row. I know that I could use lead, but I would like to try to use lag function to do the same. What I thought was lag(value) over (partition by id order by time desc), but
Is my site vulnerable to SQL injections if I get error 403?
I have a login form and just to test I tried to fill in “select * from accounts where username = test” and then I pressed enter to see what happens. I got redirected to this page: Should I be concerned about SQL injections? Or is this a normal response? Edit: the PHP code for this particular case. Answer 403
Select data from three tables only if one of them has reference to parent table
I have three tables person, his cars, his houses. And i need select persons with his cars and houses if one of childs(car, house) table have reference to parent(person). I tried with join, but don’t know how use OR in this condition. and result should be Answer You can left join twice and ensure that one of the joins succeded.
SQL statement about average
My question is -> Retrieve the segment ID and length of each segment that is longer than the average length of all segments. Name the column indicating the length of segments “Length”. Relations: What I got so far is: And I got this error message: Error: Your query has syntax errors. Description: java.sql.SQLException: ORA-00979: not a GROUP BY expression Can
Copying Data from one SQL Server Database to Another SQL Database on a Daily basis
I am trying to figure out what would be the best way to copy SQL database views from one database to another. Both databases are hosted on two different servers, so will require firewall access between them. I will need to send the views of the data on a daily basis to the required database. Copy table to a different
Get the highest category while performing other type of aggregates
Story: I am trying to get the sum of records and the max date by country and games and another column that would rank the top countries based on the sum of records: It is the country rank column that is giving me trouble. Here’s what I tried: All it does is rank the each row partition by country which
Multiple WHEN in CASE only applies first two
I have a CASE with 4 WHENs. The first two applie fine, but the last two (or any others I add past that) do not get applied. All WHENs are referring to the same field. Here’s what I’m trying to do. The field in question is formatted as: So it would look like The first Case I wrote was to
How to transform a BigQuery table into a list of row sequences where sequences are aggregated by a sliding window in time?
I have a very large table where each row represents an abstraction called a Trip. Trips consist of numeric columns such as vehicle id, trip id, start time, stop time, distance traveled, driving duration, etc. I want to transform this table into a list of Trip sequences where Trips are grouped into sequences by vehicle id and also by a