Home/
Baalkrishan Narayan Sodhi/Questions
mcqoptions.com Latest Questions
Pranay, who is an Indian, created a table named “Friends” to store his friend’s detail. Table “Friends” is shown below. Write commands in SQL for (i) to (iv) and output for (v) to (vii).
S_No. | Name | Age | City | Country | Email_ID |
1 | Alice | 14 | Washington | USA | [email protected] |
2 | Charles | 12 | Copenhagen | Denmark | [email protected] |
3 | Angle | 16 | Chicago | USA | [email protected] |
4 | Jasmine | 15 | Sydney | Australia | [email protected] |
5 | Raj | 14 | New Delhi | India | [email protected] |
6 | Jette | 13 | Nykobing | Denmark | [email protected] |
7 | Alexender | 15 | Melbourne | Australia | Null |
8 | Shashank | 16 | Bangalore | India | Null |
(i) To display list of all foreigner friends.
(ii) To list name, city and country in descending order of age.
(iii) To count how many friends have email id on gmail.
(iv) To list name and city of those friends who don’t have an email id.
(v) Select name, country from friends where age>12 and name like ‘A%’;
(vi) Select ucase(concat(name,” * “,city)) from friends where country like ‘Denmark’;
(vii) Select mid(name,1,4) as “UID” from friends where country like ‘USA’;