There is a table in which all the names of the tables are located and I need to create a table with a name from it. I give id to the input of the stored procedure and by this number I need to pull the name from another table result some I need create database schema3.Users. And this table must
Postgresql: Get columns of other table as array in a object as a column with condition
i have 2 tables, servers and virtual_machines. I want to see the virtual_machines as array in the servers where serverName equals the servers name Like this I have servers tables and virtual_machines tables I tried many options like bellow but i cant make object array in colum and postgre always add key into …
SQL – Return “True” if a customer purchased product A, and “False” otherwise [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question I have a simple SQL table with a list of customer IDs, Invoices, Products they have purchased …
Escaped single quote ignored in SELECT clause
Not sure why the escaped single quote doesn’t appear in the SQL output. Initially tried this in Jupyter notebook, but reproduced it in PySpark shell below. Output shows Bobs home instead of Bob’s home Answer Use backslash instead of a single quote to escape a single quote: Alternatively, you can u…
How to select data using like with out consider after character in laravel or sql
I have a table call labels_table. id label 1 A_1_1 2 A_1_2 3 A_2_1 4 A_4_1 5 A_10_1 6 A_11_1 I need to select all the labels for A_1 group. A_1_1 and A_1_2 should be the correct labels. I used the following query. sql Larval But both SQL and laravel queries returns all A_1_1, A_1_2, A_10_1 and A_11_1. But I
Join with same table with three different conditions
I have a requirement to join with same table with three different conditions. Below are the scenarios: Table1 : ID,NAME,INSERT_DT Table2 : ID_FK,DESC,REC_BEG_DT,REC_END_DT,REC_INDC,SYSTEM_CODE,…
Sql Performance join Vs co-related Subquery
TABLE : employee (id,mid,join_date) Question – Find all employees who joined before their managers Query 1: Query 2: Which of them is correct? If both correct, then how is the performance? Answer They are both correct. Performance questions need to be tested on your data on your system. However, with a …
MYSQL case when error when tried to get value based on condition
Why I am getting error with this query ? Is there something I’m missing ? So I wanted to get online_date if the “via” field is O, then if the “via” field is M I wanted to get the …
How to get percentage between number of rows in two separate databases?
I have two databases (A and B). I need to find the percentage between number of **rows in A** and number of **rows in B** (for example, if I have *100 rows in A* and *10 in B*, *result will be 10%*). Is there a way to do so using **JOIN** operator? I tried with “**SELECT COUNT(*) FROM DBA**” to
Multiple full joins in one query on multiple tables
I have a database with multiple tables, I wish to show all contents from every table with one query (that I will use later for a research in the database). view of the database I’ve tried with two tables but it returns an error. I’m using 10.4.14-MariaDB version. full join query error Answer One m…