Posts

Showing posts with the label output

SQL Grouping of Salaries

Image
Clash Royale CLAN TAG #URR8PPP SQL Grouping of Salaries I have a question to ask and I am supposed to create a query which shows: MIN(lastname) MAX(firstname) SUM(salary) AVG(salary) --------------------------------------------------------------- DAVIES TRINA 17500 3500 This was the query/queries I created: SQL> SELECT MIN(LASTNAME), MAX(FIRSTNAME), SUM(SALARY), AVG(SALARY) 2 FROM EMPLOYEES 3 GROUP BY JOB_ID; SQL> SELECT MIN(LASTNAME), MAX(FIRSTNAME), SUM(SALARY), AVG(SALARY) 2 FROM EMPLOYEES 3 GROUP BY JOB_ID, MANAGER_ID; But I get multiple rows shown to me and in the part where DAVIES TRINA was shown the SUM and AVG salary is different and I am unsure how they were grouped. MIN(LASTNAME) MAX(FIRSTNAME) SUM(SALARY) AVG(SALARY) ---------- ---------- ----------- ----------- ERNST DIANA 10200 5100 HIGGINS SHELLEY 12000 12000 GIETZ WILLIAM 8300 ...

how can i take an input with a textbox1 // use a for loop to count till 50 // and output it in textbox2

Image
Clash Royale CLAN TAG #URR8PPP how can i take an input with a textbox1 // use a for loop to count till 50 // and output it in textbox2 i got a textbox id="t1" that takes one input lets say the input is: 20 i use a nother textbox id="t2" for the output which shoold look like this: 21 22 23 24 25 ... 49 50 1 2 3 4 5 ... max lenght of the "numbers" = 50 with a break after every number i did the following code:: <!DOCTYPE html> <html> <head> <title></title> <script type="text/javascript"> function add() { var a = document.getElementById("t1").value; for(i = a; i<51; i++) { a+=i +"<br>"; } document.getElementsByName("t4")[0].value= a; } </script> </head> <body> <input class="t1" type="number" id="t1"> <button onclick="add()">Add</button> <br><br> <input...

sum for unique value of particular column and print

Image
Clash Royale CLAN TAG #URR8PPP sum for unique value of particular column and print I have a file in the following format: a|x|ahjkd|1 a|y|abd|2 b|x|tuj|3 b|gf|hui|4 I want the sum of column 4 for every unique value in column 1 and print all the lines along with the sum for corresponding column 1 i.e. output should be like a|x|ahjkd|1|3 a|y|abd|2|3 b|x|tuj|3|7 b|gf|hui|4|7 What have you tried so far? – Ben Jones Jul 19 at 19:34 Did you consider a particular programming / scripting language to achieve this? – πάντα ῥεῖ Jul 19 at 19:36 i want to do it using awk arrays – user6677057 J...