1answer.
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]
3 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]3 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
Three common risk factors for young drivers and how you plan to minimize these factors.
djverab [1.8K]

Answer: making a simple mistake which ends in someone getting hit or close to being hit like not turning on your signal light

going too fast which makes it more difficult to make turns properly

if the car is a manual trying to start on a hill and rolling backwards into a car

Drivers ed and practicing in a parking lot or something or the sort

Explanation:

7 0
3 years ago
On a spreadsheet, this is the term for a grouping of cells that touch each other and form a rectangle. An example of it would be
Allisa [31]

Answer:

i think answer is range

3 0
3 years ago
The concept/theory where computer generated animation (especially humans) that is TOO life-like they become uncomfortable to us
Zolol [24]

Answer:

The concept/theory where computer generated animation (especially humans) that is TOO life-like they become uncomfortable to us as viewers instead of likeable cartoons is known as Uncanny valley

Explanation:

The uncanny valley is a concept that was introduced in the 1970s by Masahiro Mori. It is used to describe when a computer generated animated figure bears too much of a resemblance to humans, to the extent that the person viewing it may feel a sense of unease. The animated figure appearing almost human would likely elicit cold and eerie feelings in viewers.

7 0
2 years ago
Read 2 more answers
Implementing an interface means that you are adding to your class any mechanisms defined in an abstract class. Your class essent
rodikova [14]

Answer:

The answer is "True"

Explanation:

The information, that is true or false in the statement is missing, which can be defined as follows:

  • The interface is a part of the Java programming language, which offers you to achieve multiple inheritances. It is also known as a common limit, that exchanges information on two or more separate parts of a computer network.  
  • It also contains the abstract method, and an interface to interface inheritance it uses extends keyword, and in the interface to a class, it uses the implement keyword.
3 0
3 years ago
Data from RAM may be placed where to free up space? Log file Swap file Word file Print spool file
hjlf

Answer:

Swap file

Explanation:

5 0
3 years ago
Other questions:
  • Wich of these is an example of magnetic storage
    11·1 answer
  • Fill in the blanks:(a)Every Java program must have at least one ______________.(b)The Java program is executed from _________ me
    12·1 answer
  • Technological _____ is the term used to describe the merging of several technologies into a single device.
    13·1 answer
  • A troubleshooter's ability to design and test hypotheses in order to solve a technology problem is based on ____.
    14·1 answer
  • An office employee working in a payroll department uses a customized program to log hours employees have worked. The customized
    12·2 answers
  • Baking Cookies. Sweet Dough Inc. bakes cookies—a popular dessert—based on the quantities ordered by their customers. Three raw m
    12·1 answer
  • QUESTION 16
    14·1 answer
  • When you use the 3 bits 100 what color will it produce?<br><br> Computer Science
    11·1 answer
  • Maria needs to use a requirement-gathering method that will help her provide a set of questions to the client. Which method shou
    11·1 answer
  • Which of the following was the first computer-animated film to win animated film to win an academy award?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!