Computer Science, asked by vishakha188, 6 months ago

037: Consider the table FANS and answer the following.
[4]
FANS
FAN ID FAN NAME FAN CITY
F001
SUSHANT MUMBAI
F002
RIYA
MUMBAI
F003 ANIKA
DELHI
F004 RUDRA
AJMER
F006 MIARA KOLKATTA
Write MySQL queries for the following:
FAN DOB
1998-10-02
1997-12-12
2001-06-30
2005-08-22
1998-11-01
FAN MODE
MAIL
LETTER
BLOG
MAIL
BLOG
i)
ii)
111)
iv)
To display the details of FANS in descending order of their BOB.
To display the details of FANS who does not belong AJMER.
To count the total number of fans of each FAN MODE.
To display the dob of the youngest fan.​

Answers

Answered by priyarksynergy
3

Given below are MySQL queries for the given table:

Explanation:

  1. The 'ORDER BY <column_name> DESC' command is used to sort the records in descending order of a particular column. QUERY: SELECT*FROM fans ORDER BY fan_d.o.b DESC ;
  2. The 'NOT' clause can be used in combination with the 'WHERE' command to show the required records under desired inequality condition. QUERY: SELECT*FROM fans WHERE NOT fan_city='AJMER';  
  3. The 'COUNT' function in combination with 'GROUP BY' can be used to obtain the number of records for given conditions. QUERY: SELECT fan_mode , COUNT(*) FROM fans GROUP BY fan_mode;
  4. The 'MIN()' function can be used to obtain a minimum value from a particular column. QUERY: SELECT*FROM fans WHERE fan_dob= MIN(fan_dob);
Answered by shahanasamin
0

Answer: select Max(dob) from fans;

Explanation: Youngest fan means the latest year in dob. Min(dob) is the eldest fan.

Similar questions