I have a table which shows me a stock ticker, asofdate, open, close. I have created a computed column called daily PL which is simply the daily close-open. ,(close-open) AS daily_pl I cannot figure …
Oracle SQL to calculate percentage
I’m trying to calculate the percentage based on the total students for each subject and by grade distribution. I have table with the following fields: Student Id Term, Course final grade I wrote the …
Implicit Data Type Conversion in Oracle
Is the statement true? Comparison between character value and a number value always implicitly converts the character value to the number data type.
How to re-run Diesel migrations?
I’m using Diesel with PostgreSQL. I added my migrations, and they worked fine, outputting everything in the schema.rs file. Until I noticed that I was missing the created_at fields on some of my migrations. I edited the SQL and ran diesel migration run. Nothing happened, no errors, no success. Is there …
Laravel query Builder Select from subquery
I’m trying to convert a sql query to a Laravel Query builder, but i find hard understand which is the best way for FORM SUBQUERY in Laravel, because if i’m not wrong, is not something that you can normally do whit query builder, but you should implement in raw. is this right? and how should transl…
How To use multiple columns
I’m trying to get a result : does not work for me, any help Answer You can use GROUP_CONCAT for that purpose day | kine | color –: | :—- | :—————– 1 | 1,2 | white,orange 2 | 1,2,3 | White,Orange,White db<>fiddle here
Is there a way of getting a proportional section of an SQL table?
I’m trying to split a single query into 4 parts, for readability purposes. Having it as a single query, while adequate, isn’t “pretty” for display purposes. An example would be a query that …
How to combine multiple sqlite queries into one line
Sorry if this question is dumb. i am a beginner and for the past hour i’v been searching the internet for answer and i haven’t found one(maybe because i am bad at searching). Anyway, i am writing a …
PostgreSQL Transform Geometries
I have a table full of Easting/Northing points that I want to transform into a column in SRID:27700. I’m using Postgres with postgis installed. I’m trying this: Of course this returns the locations in easting/northing, but when I try to first transform the points using ST_Transform, it returns SQL…
Keyword IF not expected
I have the following inline SQL code, running on an AS400. The IF comes up as unexpected but I don’t understand why. What I’m trying to do is to build a stored procedure to update, or insert, a …