for example i have an orders table with a classification column. i want to get the total per classification for each city in a state for certain identified cities, for specific date. I have done the …
Tag: sql
Oracle – update data in first table with rows from second table
How to update ‘date_from’ (t1) using ‘modfied’ (t2) when it is like 20/07/20. So in this case in t1 id’s 1 and 2 are to be updated and id 3 stays. Table 1: id date_from ———————– 1 …
merge tow querys in sql
I have a issuse in sql query. I have 2 select: The first one showing: columnA|columnB A |2 B |3 D |5 The other one showing: columnA|columnC A |1 B |5 C |7 I’m …
convert date unix to timestamp
I want to convert type date unix to timestamp in Informix. My column date1 contains values as 1598915961, 1598911249, 1598911255… expected output: 2020-02-13 15:00:00 How should I do it, please?
How to implement AFTER INSERT Trigger in Oracle PL/SQL?
I am trying to implement after insert trigger in PLSQL. The goal is to check if there are multiple (>1) rows having specific status for each client. If so I’d like to rise an exception and roll …
Get most common value in column [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I have next table: How I can get most common (common means that the count of 2 is 3, count o…
Laravel 5.6.9 – database count gives different outputs
Does anyone know why these two ways to count numbers of users in my table give different answers when i run them in tinker? AppModelsUser::count() => 92269 $count = DB::table(‘users’)->count() => 92829 Running a SQL query in Sequel Pro gives 92829. Answer If you have the SoftDelete trait …
SQL – get summary of differences vs previous month
I have a table similar to this one: It contains the stores that are active at BOM (beginning of month). How do I query it to get the amount of stores that are new that month – those that where not active the previous month? The output should be this: I now how to count the first time that each
Using WITH and subset in CASE construction
Greetings to senior colleagues. I got caught up in this thing. It is necessary to substitute the corresponding values in the CASE when the construction depending on the state of the load_date field. The problem is that the second was assigned a value to the mean_v field based on the calculation of the average…
How to structure limited voting system design
I have 3 types of tables. Categories, Candidates, Voters. To be describing the problem as short as possible, Candidates can belong to only 1 category. Voters can vote for each category and only one …