Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 01-sql-queries.sql #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion sql/01-sql-queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,29 @@ INSERT INTO marvels VALUES(12, "Rogue", 4, "Good", "Female", 1.73, 54.43, "USA",
select name, min(popularity) from marvels;
select name, max(popularity) from marvels;


/* insert a new row*/
INTO marvels VALUES(13, "R1", 82, "Bad", "Female", 1.73, 54.43, "USA", 7, 7, 7, 7, 7, 7);

/* On the basis of popularity add new column named 'public_review' */
select name, popularity,
case
when popularity<10 then 'highly popular'
when popularity>=10 and popularity<=80 then 'moderately popular'
when popularity > 80 and popularity<=90 then 'not so well known'
else 'Hmm..hv to google'
end as 'public_choice'
from marvels order by popularity;

/* display how many no. of characters are 'highly popular','moderately popular' etc. and order this list by descending order*/
select count(*) as no_of_char,
case
when popularity<10 then 'highly popular'
when popularity>=10 and popularity<=80 then 'moderately popular'
when popularity > 80 and popularity<=90 then 'not so well known'
else 'Hmm..hv to google'
end as 'public_choice'
from marvels group by public_choice order by no_of_char DESC;




Expand Down