I have a table with multiply columns. But for simplicity purpose, we can consider the following table: create table tmp_table ( entity_1_id varchar(255) not null, status integer default 1 not …
How to create Date and Hour columns from Seconds column using SQL
I have a column called Time with float values giving time in seconds after the first event occurred. I was wondering how to create columns called Date and Hour using this column in SQL. My dataset is …
Merge records that have at least one non-null element in a specific column – SQL Server
My data looks like as following: id ProteinID Gene_Name Class 10008 P08648 ITGA5 extracellular 10009 P08648 ITGA5 extracellular 10011 P08473 MME 10 NULL …
mysql error ā Operand should contain 1 column(s)ā when count occurrences in multiple columns
I want to get occurrences in multiple columns and count null values as zeros. I have tried this. select IFNULL((select id, count(*) as v from ( select id, s1 as val from t1 …
SQL how to compare two fields?
Could I get a little help/direction on this? I am new to SQL and having a difficult time finding what direction to go in here. I have 2 fields I need to compare and supply an answer based on what is …
Merge statement giving error on oracle when trying to merge two tables
i have a student table as : I have a stud_claim table as is : student_id is the foreign key of student table. At stud_claim table, I have paid_date column .paid_date has some data and some row is null.I need to update stu_claim table where paid_date is null and put the value of the service_date in that paid_dā¦
MySQL count values and put custom columns
I have this query: SELECT count(password) as normal, count(fb_id) as fb, count(google_id) as google, count(linkedin_id) as linkedin FROM `users` which returns (correctly) : normal | fb | google | …
SQL Count occurrences of multiple columns
I want to count occurrences of Number 3 from multiple columns with group by Primary Key. I have a table like this. And I have tried with this. But my output is But expected output is something …
Laravel specification search
Im building ecommerce website and i want to ask what is the best way to search specifications of product.I have a field in database with specification that can be stored as json or as php array.Is …
Get the rows of my output sorted in ascending order from this table?
I am using SQL Server 2014 and I have the following table (t1) which contains around 5,000 rows. Here is an extract of t1: n1 n2 n3 n4 n5 n6 Type 6 15 10 11 22 25 C1 2 …