Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql gap missing values

SELECT * FROM (
  SELECT x, (SELECT min(x) FROM my_table t2 WHERE t2.x > t.x) next_x
  FROM my_table t
) WHERE x <> next_x - 1;
/* if my_table contains for x:  1 2 5 6 7 10
    X		NEXT_X
    2		5
    7		10
*/
-- ⇓ Test it ⇓ (Fiddle source link)
Comment

PREVIOUS NEXT
Code Example
Sql :: pgsql sum switch case 
Sql :: creating directory /var/lib/postgresql/data ... initdb: error: could not create directory "/var/lib/postgres/data": Permission denied 
Sql :: mysql could not fetch tables 
Sql :: C# check if mysql query modified rows 
Sql :: mysql insert into select with recursive 
Sql :: tsql For XML Path('), TYPE).value 
Sql :: intellij idea add mysql connector 
Sql :: how to delete a database record after a certain time 
Sql :: oracle update multiple columns 
Sql :: oracle convert run_duration to number 
Sql :: mysql update even / odd rows 
Sql :: Laravel SQLSTATE[HY093] with array query 
Sql :: sql get frist of month 
Sql :: mysql table information 
Sql :: mysql default tls v1.3 ciphersuites 
Sql :: sql python hwo to pass a list in paramerter 
Sql :: could not find driver (SQL: PRAGMA foreign_keys = ON;) larave 
Sql :: mysql exception output 
Sql :: how to fix mysql stop unexpectedly 
Sql :: start whith system mysql 
Sql :: ring MySQL execute a query on the database then print the result. 
Sql :: flexible search query delete table 
Sql :: rollback to in sql 
Sql :: oracle create job if not exists 
Sql :: lost connection to mysql 
Sql :: Object Information 
Sql :: what is the essence of SQL? 
Sql :: mysql_error replacement 
Sql :: sqlite display headers on columns 
Sql :: in query in sql 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =