answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AlexFokin [52]
2 years ago
10

A blood bank maintains two tables - DONOR, with information about people who are willing to donate blood and ACCEPTOR, with info

rmation about the people who are in need of blood. The bank wants to know the number of males and the number of females with a particular blood group.
In the Output: each row must contain gender, BG and count of people with that CG and GENDER.

Table Schemas:

DONOR

Name -- Type -- Desc

DID int Donor ID
NAME VARCHAR Name of Donor
BG VARCHAR BLOOD GROUP
GENDER VARCHAR Gender
ACCEPTOR

Name -- Type -- Desc

AID int Acceptor ID
NAME VARCHAR Name of Acceptor
BG VARCHAR BLOOD GROUP
GENDER VARCHAR Gender
Computers and Technology
1 answer:
Kipish [7]2 years ago
7 0

Answer:

The sql query is given below.

Since we need to count of males and females for a particular blood group, we put xxx for the blood group.

SELECT COUNT(SELECT DID FROM DONOR WHERE GENDER LIKE "M%") as Male_Donors,

COUNT(SELECT DID FROM DONOR WHERE GENDER LIKE "F%") as Female_Donors

FROM DONOR

WHERE BG = xxx;

Explanation:

The clauses in the query are as follows.

1. SELECT: all the columns required in the output are put in this clause.

2. FROM JOIN ON: the table(s) from which the above columns are taken are put in this clause.

3. WHERE: any condition required to filter the output is put in this clause.

The query is explained below.

1. Find the number of male donors. Number of anything can be found using COUNT() function. A query is required since gender is included in deciding the type of donor.

2. The query is defined to find number of male donors as follows.

COUNT( SELECT DID FROM DONOR WHERE GENDER LIKE "M%"; )

3. In the previous query, LIKE operator is used since it is not defined what value is stored for male donors.

4. Similarly, the query to find the number of female donors is formed.

COUNT( SELECT DID FROM DONOR WHERE GENDER LIKE "F%"; )

5. Next, the final query is formed as follows.

SELECT: both COUNT() functions will come here.

FROM: table name

WHERE: specific blood group will be put here

GROUP BY: this clause is optional and is not used in this query.

HAVING: this clause is optional and is not used in this query.

6. The query after putting all clauses is shown below.

SELECT COUNT(SELECT DID FROM DONOR WHERE GENDER LIKE "M%"),

COUNT(SELECT DID FROM DONOR WHERE GENDER LIKE "F%")

FROM DONOR

WHERE BG = xxx;

7. Alias is used in the above query for each column to get the final query.

SELECT COUNT(SELECT DID FROM DONOR WHERE GENDER LIKE "M%") as Male_Donors, COUNT(SELECT DID FROM DONOR WHERE GENDER LIKE "F%") as Female_Donors

FROM DONOR

WHERE BG = xxx;

You might be interested in
Which statement best describes how the rapid prototyping model works?a) Developers create prototypes to show stakeholders how va
VashaNatasha [74]
Developers are aiming for two goals from their products. 
one is the amount of money they can make off of their production of inventions. 
and two is the effenciency of the produce. 

i would strongly have to go with a 
though im not very fond of computers and technology classes

6 0
2 years ago
Read 2 more answers
Assume that a gallon of paint covers about 350 square feet of wall space. Create an application with a main() method that prompt
Makovka662 [10]

Answer:

<em>C++</em>

#include <iostream>

#include <cmath>

using namespace std;

///////////////////////////////////////////////////////////////////////

int noOfGallons(int wallArea) {

   int gallon = 350;

   int gallon_price = 32.0;

   float total_price = 0.0;

   ///////////////////////////////////////////

   float noOfGallons = (float)wallArea/(float)gallon;

   printf("No of gallons needed %.2f", noOfGallons);

   cout<<endl;

   //////////////////////////////////////////

  total_price = noOfGallons*gallon_price;

   return round(total_price);

}

int wallArea(int length, int width, int height) {

   int wall_area = length*width;

   int total_price = noOfGallons(wall_area);

}

///////////////////////////////////////////////////////////////////////

int main() {

   int length, width, height;

   ///////////////////////////////////////////

   cout<<"Enter length: ";

   cin>>length;

   

   cout<<"Enter width: ";

   cin>>width;

   

   cout<<"Enter height: ";

   cin>>height;

   

   cout<<endl;

   ///////////////////////////////////////////

   int total_price = wallArea(length, width, height);

  cout<<"Total price: $"<<total_price;

   ///////////////////////////////////////////

   return 0;

}

5 0
1 year ago
Given the plaintext {0F0E0D0C0B0A09080706050403020100} and the key {02020202020202020202020202020202}: a. Show the original cont
Fiesta28 [93]

Answer:

Check the explanation

Explanation:

We will be arranging the plaintext in a 4 * 4 matrix <u><em>(which is a rectangular shaped group of symbols, numbers, or expressions, that are arranged in columns and set rows For example, the dimension of the matrix we will be using to explain the above question is 4 × 4, because there are four rows and four columns.)</em></u> in the step by step explanation below.

5 0
1 year ago
In three to five sentences, explain how you would insert graphics using your word-processing software.
madam [21]
Most word-processing programs allow the user to select a command from the menu to insert a graphic. Clicks in the document where you want your file, choose insert and picture click from file select the image the press open and you picture will become inserted in to the document.
3 0
2 years ago
Read 2 more answers
Respond to the following in a paragraph of no less than 125 words. Describe the steps to active listening.
Agata [3.3K]

Answer

• Maintaining eye contact

• Paying attention in the talk

• Listening without jumping to conclusion

• Formulating a picture in mind as you listen

• Avoid interruption to suggest solutions

• Asking clarification when the speaker has paused

• Asking questions to improve understanding

• Understanding the mood of the speaker

• Giving the appropriate feedback

Explanation

A person can improve his active listening skills by being aware of his or her personal style of communicating. A good listener is productive  and able to influence others when talking because he or she will have mastered the technique of persuading and negotiating with audience when talking. The journey to becoming an active listener is through paying attention, showing that you are following the speaker ,providing good feedback, avoiding judging the speaker and providing the appropriate feedback.



8 0
2 years ago
Read 2 more answers
Other questions:
  • Represent decimal number 8620 in (a) BCD, (b) excess-3 code, (c)2421 code, and (d) as a binary number
    7·1 answer
  • The Spinning Jenny reduced the number of workers necessary to _______. a.remove cotton seeds from fibers b.pump water from the m
    7·1 answer
  • What is the major function of the network access layer?
    5·1 answer
  • When seeking information on the internet about a variety of subjects the most useful place to look would be?
    13·2 answers
  • An mp3 takes up about 16 kilobytes of memory per second of music. if you owned a one terabyte hard drive and filled it with only
    15·1 answer
  • Which key retains its uniqueness even after you remove some of the fields?
    14·1 answer
  • Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest
    10·1 answer
  • With respect to the general classes of computers, a ________ is the most expensive and most powerful kind of computer, which is
    7·1 answer
  • Budget Analysis (use while loop) Write a program that asks the user to enter the amount that he or she has budgeted for a month.
    5·1 answer
  • When do images or graphics in Microsoft Word hurt the document rather than help
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!