I would like to split column ‘ASPCT_VLU_NM’ and count of occurrences of the timestamps in a given time frame. For example return the ID which have more than 3 occurrence in between 1537160520286 and 1537190520286. In the example below those are the timestamps : Answer If you are using Teradata 14 or later, then you may take advantage of the
Tag: sql
How to search the string in query with case insensitive on Clickhouse database?
I am developing site using PHP and backend ClickHouse database. When i using like queries , it is not supporting case-sensitive words. select id,comments from discussion where comments LIKE “%Data …
Compare two tables for a matching value from the respective columns and identify records missing
I have two tables and data like below: I want to compare two table’s columns “Type and MatchType” and identify the Ids of first table where Type is missing in MatchType. “Type” and “MatchType” are …
Find the manager details where all the employees under the manager should have salary more than 1000
Im having the table with records like below and i need to get the manager details where the all the employees under the manager should have salary more than 1000 Answer Here is a solution that uses a correlated subquery: This ensures that: the selected employee is a manager (ie they manage at least one employee) all of the managees
What is the difference between count (*) and count(attribute_name)?
Is there any difference between COUNT(*) and COUNT(attribute_name)? I used count(attribute_name) as I thought that it would be specific hence the searching process would be easier. Is that true? It would be great to see any example with sql code with my issue to help me understand better Answer Imagine this table: count(column_name) also counts duplicate values. Consider:
How to build a search bar using nodejs and sql as the database?
I have created a database using SQL and I have a functional web page built on Angular and nodejs which is connected to the database. I need to make the search bar functional. How should I proceed? Answer Create a input box in html with keyup event as : Add this function in your .ts file which will be triggered
How to transform one SQL column into multiple columns on the same row?
I am working in a Progress ODBC in Excel and I have a data set that currently holds an ID, Object type and the result for that object. The dataset looks a little like below: EveNumber …
Convert character string into this specific date format?
I am using SQL Server 2014 and I have a table (t1) which contain a column (ReviewDate) in the nvarchar format. An example of a row of this column is given below: I need to extract the “date” component from this character string. To do this, my T-SQL is as follows: This gives me “Oct 2017”. Now, I want to
How long in years the artist was in the band for all artists who are or ever have been in bands
For the artists currently in bands, the value is null. How can I calculate how long they have been in the band if the value is null using mySQL? I was thinking of doing something like this, which only works for artists who have left a band. Answer I haven’t done SQL for a while so please bear with me.
Find IDs and names of students who took CS-101 and did not take CS-319
Can someone help with this homework problem: Find IDs and names of students who took CS-101 and did not take CS-319. These are the two tables that I can use for this assignment: I tried this but was unable to successfully exclude the students who who took “CS-319” Answer There are at least three separate ways to solve this problem