Imagine there is a table with 1000 columns. I want to add a row with values for 20 columns and assume NULLs for the rest. INSERT VALUES syntax can be used for t
Table Name: Worker, Fields : worker_id | first_name | last_name | department I have a table name worker and i wanted to write an SQL query that fetches the uni
I have a data set like this. CREATE TABLE EntityItems ( Id INT NOT NULL, EnitityItemId INT NOT NULL, PRIMARY KEY (Id, EnitityItemId) ); INSERT INTO
When it comes to database replication, what is the use of global transaction identifiers? Why do we need it to prevent concurrency across the servers? How is th
I'm trying to solve the Hackerrank problem Weather Observation Station 3 which is stated below: I came up with the following solution: SELECT CITY FROM STAT
I want to merge multiple record into single record Ex: Input pdt status start_dt end_dt a Inactive 2022/02/02 2022/02/04 a Inctive 2022/02/05 2022/02/10 a Acti
I have following incrementing id: create table PATIENT ( PATIENTID INTEGER generated by default on null as identity ( start wit
Query: Query the 2 cities contained in STATION table with the shortest and longest CITY names, as well as their respective lengths (i.e.: numb
This is what I am trying to do: SELECT id, name FROM users WHERE isActive=true (AND CASE WHEN {param} != null THEN name={param} ELSE null E
How to update record many columns with the same data of existing record in the same table . For Example : id name m_value 1 moh 1000 2 jo 0
I'm getting this error from SQL Server on SSMS 17 while running a giant query: Conversion failed when converting the ****** value '******' to data type ****
Does anybody know what is the limit for the number of values one can have in a list of expressions (to test for a match) for the IN clause?
I'm new to postgresql. Can anyone suggest the reason and solution to this error? However it works if I select an extra sum(s.length) but i don't won't this in m
I'm working in a centralized monitoring system on Windows 2008 R2, I have installed a PostgreSQL 9.3 to use psql from the command line. When I try to access to
I have my sql query which displays fields using "where" from a variable. I have my variable passed from a function string empCode which value is "!\\(" Here's
I'm working with MariaDB. when I try to show some result don't show me nothing. select if(fecha is null,'hello','bye') dat from table I'm trying to
I am working on an app that is providing a way for an user to define a SQL query and run it against the database. The only purpose of the query is to create a d
I am working with healthcare data that comes from a table that only has one column for procedure code billed, but multiple lines of transactions for each claim
I need to write a query that returns the latest message in a conversation between two users. I've included the schema and my (failed) attempts in this fiddle: h
i need to sum this varchar values. time 1 = '13:06' time 2 = '18:59' time 3 = '14:49' i tryed this. SELECT convert( char(8), dateadd( secon