So I am very confused by this query to display teachers’ full name. I have used teacher_name ||’ ‘|| teacher_lastname, but when I try to do so for the students, something happens. I am trying to get …
Tag: sql
How can I secure this sql query from SQL Injection in Laravel?
I am trying to create restAPI in Laravel. How can I secure an SQL query like this from sql injection? Answer Laravel’s database query builder provides a convenient, fluent interface to creating and running database queries. It can be used to perform most database operations in your application and works…
DB link in postgres looking at another localhost image : relation tablename does not exist
i’m using docker to host two different postgresql instances to try and produce a proof of concept for python as an etl to move data between the two i can connect to the one via python fine but then when calling a procedure inside the first instance it cant find the table in the second instance im connec…
Cursor based pagination for table without a unique and sequential id column?
I’m investigating using cursor-based pagination. I have the following (postgres) table: and had begun to sketch out the pagination query (not tested): I’ve been reading these posts: https://slack.engineering/evolving-api-pagination-at-slack-1c1f644f8e12 https://engineering.mixmax.com/blog/api-pagi…
How can I turn this query that uses a join statement into a query that uses a subquery?
I’m given the query and told to rewrite it using a subquery. I tried writing but I get an error saying the column isn’t recognized? Answer You are trying to access sub-query (or inner query) table’s column outside and hence the error. Please try this:
SQL to Get Latest Field Value
I’m trying to write an SQL query (SQL Server) that returns the latest value of a field from a history table. The table structure is basically as below: ISSUE TABLE: CHANGEGROUP TABLE: CHANGEITEM TABLE: EXPECTED RESULT: So each change to an issue item creates 1 change group record with the date the chang…
Split and compare two Strings in Oracle SQL
I have a table with three columns structured as followed: Now I would like to perform an Oracle-SQL-query which gives me the edit-pattern of the two strings left and right. The result should be as followed: Al my tries with REGEX_SPLIT and CONNECT BY were not successful. Do you have any ideas how to solve tha…
Oracle Select max where a certain key is matched
i’m working with oracle, plSql, i need to query a table and select the max id where a key is matched, now i have this query It’s displaying this data If i remove the ID from the query, it displays the distinct keys (in the query i use the alias KIES because keys was in blue, so i thought it
H2 database – Update from select sets out-of-date data after h2database upgrade to version 1.4.198
We have a simple counter in out project database. Until now we were using version 1.4.197 of H2 database. Executing below example snippet with this version always imply counter to be 5000. Upgrade to version 1.4.198 or above makes below code returning inconsistent results, usually between 1500 and 2000. My as…
SQL error ‘ER_OPERAND_COLUMNS: Operand should contain 1 column(s)’ for DELETE function
Trying to delete rows that exist in both temp_abstract table and abstract table. When I just run what’s inside the parentheses it returns what I want, but adding a delete from where seems to throw this error. Any help? Answer You can use EXISTS instead : Sub-query will return only one expression while u…