[Solved] Double the current time [closed]

If you really what to work only with the time element, the easiest way to so is to employ the ‘SSSSS’ date mask, which returns the number of seconds after midnight. So this query will return double the number of seconds between the two columns: select ( to_number(to_char(atn_inn, ‘sssss’)) – to_number(to_char(acn_inn, ‘sssss’)) ) * 2 … Read more

[Solved] Condition statement in a select

Select X, Y, NVL(Z, showThis) as Z will return showThis if Z is null in ORACLE Select X, Y, ISNULL(Z, showThis) as Z will return showThis if Z is null in SQL-SERVER 0 solved Condition statement in a select

[Solved] ORDER A TABLE BY TWO COLUMNS

A partial solution might be SELECT . . . customer.customer_corporate_name, isnull(customer.siren_corp ,Replace(customer.comm_regnum_cust, ‘ ‘, ”)) AS SiretSiren . . . FROM customer JOIN customer_status . . . ON customer_status.status_id = status.status_id ORDER by customer.customer_corporate_name,SiretSiren solved ORDER A TABLE BY TWO COLUMNS

[Solved] Using python and pandas I need to paginate the results from a sql query in sets of 24 rows into a plotly table . How do I do this?

Using python and pandas I need to paginate the results from a sql query in sets of 24 rows into a plotly table . How do I do this? solved Using python and pandas I need to paginate the results from a sql query in sets of 24 rows into a plotly table . How … Read more

[Solved] PostgreSQL query to split based on Strings & Concatenate them into new individual columns

Use string_to_array to split the string into multiple elements that can be accessed individually: select rules[1] as rule_1, rules[2] as rule_2, rules[3] as rule_3, rules[4] as rule_4, rules[5] as rule_5, rules[6] as rule_6 from ( select string_to_array(rules, ‘|’) as rules from rulebook ) t 1 solved PostgreSQL query to split based on Strings & Concatenate … Read more

[Solved] Database model for car-service [closed]

Maybe a table like this one can help you model the price changes: create table service ( id int primary key not null, name varchar(50) ); create table car_type ( id int primary key not null, name varchar(50) ); create table location ( id int primary key not null, name varchar(50) ); create table service_price … Read more

[Solved] Find the top 30% of the industry’s revenue in the past 12 months through SQL [closed]

This Query will definitely help you SELECT A.*, P.30_PERCENT_REVENUE FROM STACK_USER.revenue AS A JOIN (SELECT TRIM(B.industry_category) AS industry_category, (((SELECT SUM(REVENUE) FROM STACK_USER.revenue WHERE industry_category=B.industry_category)/100) *30) AS 30_PERCENT_REVENUE FROM STACK_USER.revenue AS B GROUP BY B.industry_category AND MONTH(DATE)>=MONTH(SYSDATE()) AND YEAR(DATE)>=YEAR(SYSDATE())-1) AS P ON TRIM(A.industry_category)=P.industry_category AND A.revenue>=P.30_PERCENT_REVENUE; I was very confused by your question because the question is … Read more

[Solved] Conversion function in SQL Server

Seems like you want to turn a base36 number into a base10 number. Then you could create a function for base conversion. The function create function dbo.fnBase36ToBase10(@input varchar(8)) returns int as begin declare @base36string varchar(8) = upper(@input); declare @result int = 0; declare @basechars varchar(36) = ‘0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ’; declare @N int = 36; declare @digit char(1); … Read more

[Solved] MySql database structure for : Search based on single column and different value [closed]

try this: create table City ( Id int, Name varchar(50) ); insert into City (Id, Name) VALUES (1, ‘Toronto’), (2, ‘Chicago’) create table Libraries( Id int, Name varchar(50), CityId int ); insert into Libraries (Id, Name, CityId) VALUES (1, ‘Toronto Library 1’, 1), (2, ‘Toronto Library 2’, 1), (3, ‘Chicago Library 1’, 2), (4, ‘Chicago … Read more