I have a requirement that needs columns with values to be transposed into rows. For instance refer to the table below: cust: cust_id | cover1 | cover2 | cover3 1234 | ‘PAG’ | Null | ‘TDE’ 5678 | …
Tag: sql
Create View based on join of column name and table value of two tables
I got two tables. and a second The resulting View I need would look like this: I only managed to get it done with one column combined with a where clause: I would probably need some command which loop through the column names and joins column names with the values in the attribute column, because the real tab…
Getting date, and count of unique customers when first order was placed
I have a table called orders that looks like this: And that contains the following data: I would like a result set returning each unique date, and a separate column showing how many customers that placed their first order that day. I’m having problems with querying this the right way, especially when th…
How to filter table with entity from other tables related by many to many relationship using GORM?
I have Product table which is connected with the other two tables Categorie & AttributeValue using many to many relationships. I am using GORM as an ORM. go struct for those tables are like bellow….
Do triggers take a lot of computation?
When implementing “Triggers” , is it required to check the criteria/condition for trigger WHENEVER a change is made? If it is so, can someone have a large number of triggers? Or else, how is it done?
Difference between using a database driver and subprocess [closed]
I always using a driver for database adapter because thread safety. But I have seen that some developers (specially system engineers) using subprocess for database queries, something like this: …
Group by combination count in postgresql
I have a database table as like table_name (participant_member) : dataset and output formate link I need combination based group by unique count for example if a member already stay in purpose p1 …
SQL count column from another table
I have two tables in a database The first being people which has the columns id: int, name: varchar(10) and another being relationships which represents a one way following me: int following: int …
INSERT into statement not working in oracle when using INSERT INTO .. SELECT * FROM
I have vh_emp table whose table structure is(This is empty table): I am taking data from employee table as source table where I wrote some query to match with vh_emp table: SELECT e.emp_id …
Why sql query extract other info
I want get city attribute from my database. But when I run my code I get this info (u’Rome’,) I want get only Rome as result This is my code connection = mysql.connector.connect( …