Add multiplicity as rows

I use Sparx EA to build a relationship database (MS SQL Server). The tool has a function to create charts. I use the query: SELECT system.Name AS Series, systemElement.Name AS GroupName FROM t_object …

Create Continuous Enrollment islands for a certain sub-population

My end goal is to create islands of continuous enrollment days for each CLIENTID for a single sub-population: ‘Adult Expansion’ for calendar years 2019 and 2020. A CLIENTID can be associated with …

Pivoting a dynamic column based on split value

I Have a couple of tables as per below Position table Id PositionName 1 Developer 2 Analyst 3 Tester Employee table Id Name Positions 1 John 1,2 2 Lisa 3 3 Smith 1 4 Willow NULL 5 Burly 2,3 …

How to select students with marks in all three subjects less then 100

I came across this question Here is my response to it, I just started myself learning SQL recently. Select a.roll_number , a.name , b.roll_number from student_information a join …

Get rows of Last hour, Last ‘x’ minutes in SQL Server

Order ID Picker ID Time_Picked 1 111 2020-01-13 11:28:00 2 222 2020-01-13 11:40:00 3 333 2020-01-13 10:00:00 4 444 2020-01-13 9:00:00 5 555 2020-01-13 9:45:00 SELECT * FROM mytable WHERE …

adding trimmed substrings

using sql server: I have a number of commands that trim a txt file, example: Case when charindex(‘-‘, Substring([RawStreamOut], 179, 10)) > 0 then ‘-‘ + Replace(LTrim(RTRIM(…

Split string without string_split (Sever 2012) [closed]

I would like to know if and if it’s possible how to split a string in to different columns. So first of all I have the table tabOld which contains: name 5522-rep__-4210-03-test-434907-emn-nt.pdf …

Group by Count of DateTime Per Hour by removing Duplicates?

I have a table named loginData: userName timestamp abc ‘2007-01-01 12:00:12 AM’ def ‘2021-01-01 12:09:12 AM’ abc ‘2021-01-01 12:40:12 AM’ abcde ‘2021-01-01 12:44:12 AM’ From this …

Create calculated field from MIN() and MAX() values of another column, grouped by unique ID

I have a table that looks like this, containing information about an object’s position and the length of time it existed for (age): Date ID Age x y 2021-03-25 20 1 531 295 2021-03-25 20 …

How to copy information in SQL from one table to another

I need to build a query to copy information in a column from one table to a column in another table. This is how the tables looks like: People: PersonId Name StatusId 1 John 2 Jenny 3 Steve …