NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

create table test_table_pivot(
id int not null,
name nvarchar(30) null,
lastname nvarchar(30) null,
year int null,
sum_bonus float null
)

insert into test_table_pivot (name, lastname, year, sum_bonus) values
('Simon', 'Karapetyan', 2017, 200),
('Simon', 'Karapetyan', 2017, 100),
('Simon', 'Karapetyan', 2018, 150),
('Simon', 'Karapetyan', 2018, 100),
('Simon', 'Karapetyan', 2019, 100),
('Simon', 'Karapetyan', 2020, 120),
('Simon', 'Karapetyan', 2020, 80),
('Narine', 'Vardazaryan', 2017, 100),
('Narine', 'Vardazaryan', 2017, 100),
('Narine', 'Vardazaryan', 2018, 100),
('Narine', 'Vardazaryan', 2019, 80),
('Narine', 'Vardazaryan', 2019, 120),
('Vardan', 'Nazaryan', 2017, 200),
('Vardan', 'Nazaryan', 2017, 120),
('Vardan', 'Nazaryan', 2018, 150),
('Vardan', 'Nazaryan', 2018, 150),
('Vardan', 'Nazaryan', 2020, 160)

select name, lastname, year, sum(sum_bonus) as total
from test_table_pivot
group by name, lastname, year

select name, lastname, [2017], [2018], [2019], [2020]
from(
select name, lastname, sum_bonus, [year] from test_table_pivot
) as new_t
pivot (sum(sum_bonus) for [year] in ([2017], [2018], [2019], [2020])) as test

create table product_stock(
id int not null,
product_name nvarchar(50) null,
stock1 int null,
stock2 int null,
stock3 int null,
stock4 int null
)

insert into product_stock (product_name, stock1, stock2, stock3, stock4) values
('mouse', 10, 10, 20, 25),
('keyboard', 18, null, 34, 10),
('printer', 2, 9, 6, 5),
('scanner', null, 6, 10, 3)

select * from product_stock

select product_name, stocks, quantity from product_stock
unpivot (quantity for stocks in (stock1, stock2, stock3, stock4)) as new_unpivot
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.