gaps-and-islands Questions
3
Solved
I have a large set of numbers, basically 1001 .. 150000 for a database using MySQL
There are a ton of gaps in the IDs on the database, so not all IDs exist. It can go from 100000 - 10500, then the ...
Header asked 6/8 at 19:6
17
I have a column named sequence. The data in this column looks like 1, 2, 3, 4, 5, 7, 9, 10, 15.
I need to find the missing sequence numbers from the table. What SQL query will find the missing seq...
Incorruptible asked 29/6, 2009 at 9:27
6
Solved
Im working on a SSRS / SQL project and trying to write a query to get the gaps between dates and I am completely lost with how to write this.Basically we have a number of devices which can be sched...
Hugely asked 7/3, 2012 at 15:36
23
Solved
I'd like to find the first "gap" in a counter column in an SQL table. For example, if there are values 1,2,4 and 5 I'd like to find out 3.
I can of course get the values in order and go through it...
Blasting asked 21/8, 2009 at 13:56
5
Solved
Given the following table:
ID State Date
12 1 2009-07-16 10:00
45 2 2009-07-16 13:00
67 2 2009-07-16 14:40
77 1 2009-07-16 15:00
89 1 2009-07-16 15:30
99 1 2009-07-16 16:00
Question:How can i GRO...
Spheroidal asked 16/7, 2009 at 10:1
9
Solved
I want to fill the calendar object which requires start and end date information. I have one column which contains a sequence of dates. Some of the dates are consecutive (have one day difference) a...
Elison asked 5/12, 2013 at 14:5
7
Solved
I have a table with 2 columns, date and score. It has at most 30 entries, for each of the last 30 days one.
date score
-----------------
1.8.2010 19
2.8.2010 21
4.8.2010 14
7.8.2010 10
10.8.2010 ...
Icaria asked 21/8, 2010 at 20:30
2
Solved
I was asked this question in a job interview:
There is a table with vehicle names mentioned in a column. Output when we check for name=car we must get as 4 i.e the maximum count of continuous occu...
Scanty asked 7/6, 2023 at 12:35
8
Solved
I got following question on an interview:
Given a table of natural numbers with some missing ones, provide output of two tables, beginning of number gap in first table
and ending in second.
Example...
Luckey asked 24/9, 2010 at 15:28
16
Solved
We have a database with a table whose values were imported from another system. There is an auto-increment column, and there aren’t any duplicate values, but there are missing values. For example, ...
Kinson asked 2/12, 2010 at 22:45
4
Solved
Does anyone know how to replace nulls in a column with a string until it hits a new string then that string replaces all null values below it? I have a column that looks like this
Original Column:...
Jackquelinejackrabbit asked 7/2, 2020 at 0:51
5
Solved
I have a table with (among other things) dates in a field.
I need to get a list of all dates that are more recent than the oldest date, older than the most recent date, and are completely missing...
Comedown asked 6/3, 2012 at 22:28
6
I need some help with a mysql query. I've got db table that has data from Jan 1, 2011 thru April 30, 2011. There should be a record for each date. I need to find out whether any date is missing fro...
Balsa asked 1/7, 2011 at 17:19
16
Solved
How do you find the smallest unused number in a SQL Server column?
I am about to import a large number of manually recorded records from Excel into a SQL Server table. They all have a numeric ID (...
Nereus asked 26/3, 2009 at 0:52
23
Solved
Using standard mysql functions is there a way to write a query that will return a list of days between two dates.
eg given 2009-01-01 and 2009-01-13 it would return a one column table with the val...
Maleficence asked 4/2, 2009 at 3:58
3
Solved
Given a table like:
person_id
contact_day
days_last_contact
dash_group
1
2015-02-09
1
1
2015-05-01
81
2
1
2015-05-02
1
2
1
2015-05-03
1
2
1
2015-06-01
29
3
1
2015-08-01
61
4
1
...
Anamorphic asked 9/5, 2022 at 9:0
2
Solved
SQL FIDDLE
I have the following database table:
date
name
2014-08-10
bob
2014-08-10
sue
2014-08-11
bob
2014-08-11
mike
2014-08-12
bob
2014-08-12
mike
2014-08-05
bob
2014-08-06...
Roundish asked 14/5, 2021 at 4:44
11
Solved
I am doing a project creating an admission system for a college; the technologies are Java and Oracle.
In one of the tables, pre-generated serial numbers are stored. Later, against those serial n...
Thermomotor asked 10/6, 2012 at 12:1
3
Solved
I have a table invoices with a field invoice_number. This is what happens when i execute select invoice_number from invoice:
invoice_number
--------------
1
2
3
5
6
10
11
I want a SQL that gives...
Oversee asked 11/5, 2015 at 13:3
2
Solved
I am trying to write a query in sql where I need to find the max no. of consecutive months over a period of last 12 months excluding June and July.
so for example I have an initial table as follows...
Dealfish asked 10/1, 2022 at 1:51
0
I have PersonId and his special days.
I need partition this dates to periods.
Current table:
+----------------+-------------+
|EmployeePosition|DeviationDays|
+----------------+-------------+
|1925...
Lurleen asked 21/10, 2021 at 13:50
4
Solved
I have tried several topics like this one: How to find missing data rows using SQL? here, but I couldn't make it work in my situation.
I have a table named posts in MySQL which I save user diaries...
Ayannaaycock asked 2/4, 2011 at 10:53
3
Solved
Lets say we have a database table with two columns, entry_time and value. entry_time is timestamp while value can be any other datatype. The records are relatively consistent, entered in roughly x ...
Anetteaneurin asked 18/6, 2012 at 15:3
8
I have a table with the columns Age, Period and Year. The column Age always starts with 0 and doesn't have a fixed maximum value (I used 'Age' 0 to 30 in this example but the range could also be 0 ...
Chappell asked 4/9, 2020 at 5:20
2
Solved
I want to rank on ID and value columns based on ascending order of UID. Expected output has to change once value column has a different value than the previous value. Ranks has to restart on each n...
Pacifically asked 17/9, 2020 at 16:54
1 Next >
© 2022 - 2024 — McMap. All rights reserved.