I need the sql query to get outout like below. I have some test files and need output like below [closed] - sql

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 3 days ago.
Improve this question
Table
Company1 Table
Company2 Table
I need to calculate below details year wise (as given in the output) for each company and also need the output in consoilidated level. Calculation logic also written in 2nd column.
Required Output Company level (2 outputs)
Required Output consolidated level (1 output)
instructioins
must produce 2 types of output in excel
a. At the Company Level
b. At the Consolidated Level
total 3 output
2 company level
1 consoliodated level
tried using pivot function but not able to solve

Related

Creating a measure from two columns present in two different fields [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 5 days ago.
Improve this question
I am new to Power BI. I know how to create a measure between two columns present within a field. But how do I create a measure from two different columns present in two different fields (IVIGUsage and TargetvsActuals?
I need to create a measure for gram variance and grams to target. So, could you please help me out? Earlier I had created the measure based on the one field targetvsactual which are as:
%GM_Target = Calculate(
DIVIDE(
Sum('TargetVsActuals'[Total_Grams]),
SUM('TargetVsActuals'[Target_Grams])))
Gram Variance = (Sum('TargetVsActuals'[Target_Grams]) - Sum('TargetVsActuals'[Total_Grams]))
So, this has to be modified. Please help me out.

Is there a faster way to add new column data with hundreds of rows? [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 11 months ago.
Improve this question
I have a decent-sized table 'countries' with about 10 columns. I recently added a new column to the table 'GDP' and I am entering the information per row using
UPDATE countries
SET GDP=(value)
WHERE name = (country);
I have 200 countries in this table. Is there a better way to update this information?
This project is from Khan Academy. We are asked to select a database and run queries on it. The data was pulled from https://gist.github.com/pamelafox/ad4f6abbaac0a48aa781
I am just making sure that there isn't a more efficient way of adding this information to the existing table 'countries' where the primary key is the name of the country.

Block pl/sql whit HR db [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
a Create a PL / SQL block that shows ids not assigned to employees.
b. Create a PL / SQL block where you place the department's id and return the name of the head of that department.
c. Create a PL / SQL block where you place the id of the employee and return the names of the charges it has occupied in the past.
the ponit A ITS DONE ---- all the id's are full so it does not show results.
enter image description here
the point B dont work
enter image description here
As mentioned in my comment:
Looks the dbms_output is not enabled in your session. Click on the plus sign at the end and choose the schema and then re-run the block. See below circled in red.

Plotting data R [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 6 years ago.
Improve this question
I have a simple tasks I would like to do. Using an RODBC connection I have connected R to a SQL server database. There are four tables in the database and they are tenors of Libor rates
Libor_1_mos
Libor_3_mos
Libor_6_mos
Libor_12_mos
Each table has two columns. The first column shows dates and the second column shows rates.
I would like a simple chart that plots the rates based on the dates in column 1. Straightforward - that is all that needs to be done. The x-axis should be dates (column 1) and the y axis should be rates (column 2). Note it is 5 years worth of data so showing every possible date on the x-axis may not be feasible.
Here is my work so far I am using the Libor_3_mos as an example
threemosdata <- sqlQuery(con,"select * from Libor_3_mos)
Using that line I can read the data from the table. So for instance
colnames(threemosdata)
will give me the names of the column in the table.
So this worked lovely
> date <- (threemosdata$observation_date)
> rates <- (threemosdata$USD3MTD156N)
> plot(date,rates)

like query for searching a multiple word in table column in sql [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 8 years ago.
Improve this question
I have table named 'categories' and it has one column name 'catvalues' with values see example below:
catvalues
------------------------
Party wear,Plain,Classic
Party wear,Plain
Party wear,Classic
now i want like query which when i search for 'Party wear,Classic' it should return 2 rows like below:
catvalues
---------------------------
Party wear,Plain,Classic
Party wear,Classic
maybe something like...
SELECT * FROM table
WHERE catvalues LIKE '%Party wear%Classic%'
but i really need more info about your questions
This sounds like your trying to put to much information into one column.