Category "sql"

Can SQL be injected when the input is hashed?

The passwords and my SQL database are hashed. If the input is hashed, can the field be injected? The hash is SHA256. My command is to be: SELECT true FROM acc

How to search tree structure with multiple types with TypeORM

thanks for reading and provide any suggestions or any keyword I can do more research. Quite new to TypeORM and have an issue on searching the tree structure wit

Concatenate the contents of two rows into one column (SQL DB2)

as it says in the title, I need to return two records but in the same column, for example (I clarify that the following code does not work, it is only to unders

PGSQL query to get all records of a column containing line breaks

What is the shortest Pgsql query to get all records that contain a line-break in a given column ?

Azure SQL: generate JSON with column as key

I have the below data in my sql server table Name Value ValueHash country aaa zzz lastname ccc yyy email [email protected] xxx firstName bbb www And I want the below Js

Subtracting rows based on condition

Suppose I have a table that looks like this: OrderNumber OrderType 1 D 1 D 1 R 2 D 2

Error when trying to use count and group by

Here is my query: SELECT DISTINCT takes.semester, takes.sec_id, takes.course_id, instructor.name, COUNT(takes.ID) FROM takes INNER JOIN teaches ON takes.cour

DBMS ERD Design

I am planning out an application's database. I have an employee table. I want to store every employee's education degree. Adding an education column to the empl

MySQL How to join 2 tables and get a combined response

I have 2 tables projects and images. My goal is to get all images of a project and get this kind of response. { "data": { "id": "this is project id",

how to display columns in specific order, according to field value in MS Access

I want to display a query but the column order needs to be sorted according to the value in the column, field with greater value as column 1, then second greate

SQL Query to get the last unique value from a column

I have a SQL table with the following columns: id | created_at I want to get a dictionary of all the unique id's and the latest created_at time. My current quer

First time SQL query is taking More time from Spring Boot application

I have to fetch some records and then display in output. In my Spring Boot Application, I am using JPA Specification for creating Criteria and then calling repo

SQL returning all rows and count

I have 3 tables, Property managers, Addresses and Units. I'm trying to get all the rows using the aggregate function COUNT, but it only returns 1 row. I want to

MYSQL query that works out the total amount of days between different time periods for a payroll

I know this question may seem like a simple one and might have been asked before but what makes this tricky is how do I work out the total days for a payroll. N

SQL Server - Regex pattern match only alphanumeric characters

I have an nvarchar(50) column myCol with values like these 16-digit, alphanumeric values, starting with '0': 0b00d60b8d6cfb19, 0b00d60b8d6cfb05, 0b00d60b8d57a2b

Removing leading zeros from a string in SQL Server

i have removed all leading Zeros in my column but what if the same column has a space its replaced by '0'.. Example: batch number has 000123, 0000145 but when t

[Python][SQL Machine Learning Services] Cannot install XGBoost on my SQL instance

I am trying to find a solution to my problem. We are trying to install XGBoost package on our MS SQL 2018 and we are facing this problem: Error Description The

Best way to get list of element combinations from two mysql tables

I have two tables: Table "products" ID Name Price Quantity 1 Product A 10 10 2 Product B 20 10 Table "promotions" ID Product ID Type Price Quantity 1 1 disco

Capitalize the first letter of each word without affecting the consecutive letters

I would like to make the first letter of each word capitalized. However, if the word next to the first letter is already capitalized, then it should not be affe

how to avoid long sql in clickhouse

As ClickHouse can run complex SQL efficiently, we now write hundred-lines-in-one SQL to get the real time analysis results(join lots of source table). And it br