Skip to content
Advertisement

Tag: sql

Select in a select from another table [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 6 months ago. Improve this question I need to make a query to another table and add the result

Count rows within date range with condition

I’m not sure that this issue can be solved in SQL server, but I decided to ask you anyway. Let’s create a table and add some random variables: Now, let’s add to the table two columns: “before_5” – five minutes before the given timestamp “after_5” – five minutes the given timestamp Now our table looks in the following way: timestamp

How to find a salary which does not end with Zero

I have been trying to write a query where I need to find a salary which does not end with ZERO My Query : select salary from employees where REGEXP_LIKE (Salary, ‘^(1|2|3|4|5|6|7|8|9)$’); Answer I would just use the modulus here: By definition, the modulus 10 returns the single (final) digit in the salary. Going this route avoids a costly conversion

SQL Select Duplicate Values based on Specific Condition

I am asking for a solution where I can find duplicate entries in a table but one of those duplicate entries MUST contain a specific value otherwise it won’t come in the result. For example, my table is like this: ID Name Type 1 Hassan Commercial 2 Ahmed Personal 3 Jack Personal 4 Hassan Commercial 5 Jack Commercial 6 Charlie

What am I getting wrong in this SQL query?

Write a query that retrieves only a ranked list of the most prolific days in October 2020, prolific measured in number of posts per day. Your query should return those days in a single-column table (column name post_day) in the format YYYY-MM-DD. This is my table: This is my query: The problem is that I’m only getting one result, not

SQL case expression divide values for percentage

I’m trying to divide two values to get the percentage. I need the ‘VA’ AUM / ‘TOTAL’ AUM to get the percentage. Below are the two different methods that I have tried, but they are not providing the percentage. The first method only provides ‘NULL’. How do I take the product of ‘VA’ and the AUM field value and divide

Data inconsistencies between two tables

I have an SQL question in which I am struggling to understand and find relevant resources to help me. The question is: “Write an SQL query to identify data inconsistencies between two tables.” I need to compare the following tables of data: AssetManager AssetManagerName John Doe Joe Smith Dave Grey Lisa Sparks Kate Green Trip PropertyCode AssetManagerName Date P001 John

Advertisement