Computer Science, asked by brainlyuser280, 1 month ago

Consider the table ‘PERSONS’ given below. Write commands in SQL for (i) to (iv) and write output for (v) to (vii).

Table: PERSONS

Attachments:

Answers

Answered by Equestriadash
12

(i) To display the SurName, FirstName and city of people residing in Udhamwara City.

  • Select SurName, FirstName, City from Persons where City = 'Udhamwara';

(ii) To display the PID, City and PinCo‎de in descending order of Pinc‎ode.

  • Select PID, City, PinCo‎de from Persons order by PinCo‎de desc;

(iii) To display the FirstName and City of all the females getting BasicSalary above 40000.

  • Select FirstName, City from Persons where Gender = 'F' and BasicSalary > 40000;

(iv) To display the FirstName and BasicSalary of all persons whose FirstName starts with 'G'.

  • Select FirstName, BasicSalary from Persons where FirstName like 'G%';

(v) Output for: Select SurName from Persons where BasicSalary >= 50000;

\begin{array}{|c|}\cline{1-1}\tt SurNa me\\\cline{1-1}\sf Sharma\\\cline{1-1}\sf Singh\\\cline{1-1}\sf Alvis\\\cline{1-1}\end{array}

(vi) Output for: Select Sum(BasicSalary) from Persons where Gender = 'F';

\begin{array}{|c|}\cline{1-1}\tt Sum(BasicSalary)\\\cline{1-1}\sf 132000\\\cline{1-1}\end{array}

(vii) Output for: Select Gender, Min(BasicSalary) from Persons group by Gender;

\begin{array}{|c|c|}\cline{1-2}\tt Gender & \tt Min(BasicSalary)\\\cline{1-2}\sf F & \sf 40000\\\cline{1-2}\sf M & \sf 33000\\\cline{1-2}\end{array}

(viii) Output for: Select Gender, Count(*) from Persons group by Gender;

\begin{array}{|c|c|}\cline{1-2}\tt Gender & \tt Count(*)\\\cline{1-2}\sf F & \sf 3\\\cline{1-2}\sf M & \sf 4\\\cline{1-2}\end{array}

Answered by kavitashirsath945
0

Answer:

this is your photo open this

Attachments:
Similar questions