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
Although the Earth's crust formed relatively early in the Earth's history, it was not present when the Earth first began to form
zlopas [31]
The Earth is older than 4.28 billion years
5 0
3 years ago
Read 2 more answers
Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4,999. The drive is currently serving a request at cylinder 2,050,
cluponka [151]

Answer:

a. 18102

b. 5656

c. 6090

Explanation:

Pleaae kindly check attachment for the detailed and step by step solution of the given problem.

7 0
3 years ago
What should you do if ads keep popping up on your computer when using Google Chrome?
romanna [79]
I think it’s B.. I’m pretty sure
8 0
3 years ago
In risk management what does risk evaluation involved
VLD [36.1K]

Answer:

Explanation:Risk management is the decision-making process involving considerations of political, social, economic and engineering factors with relevant risk assessments relating to a potential hazard so as to develop, analyze and compare regulatory options and to select the optimal regulatory response for safety from that hazard.

5 0
3 years ago
A review of the sales, costs, and profit projections for anew product to find out whether these factors satisfy the company'sobj
soldier1979 [14.2K]

Answer: Business analysis

Explanation:

Business analysis is the review of the sales, costs, and profit projections for a new product to find out whether these factors satisfy the company's objectives.

Based on the business analysis a company is able to set a marketing strategy for a better promotion of its products. So this step is particularly very important.

7 0
3 years ago
Other questions:
  • The combination of two or more technologies or data feeds into a single, integrated tool is referred to as a _____.
    7·1 answer
  • What type of topology gives you a direct connection between two routers so that there is one communication path?
    14·1 answer
  • Sarah, a computer user, tells James, a computer technician, that the network she is connected to is running too slowly. Which of
    5·1 answer
  • For which type of long-distance call do you need to tell the operator the name of the person to whom you wish to speak?
    10·1 answer
  • It is a small hand tool used generally in decorative works such as making garnishes
    15·1 answer
  • It’s Saturday and you’re looking forward to hanging out with friends and having some fun. However, you get two phone calls early
    10·1 answer
  • Given a constant named size with a value of 5, which statement can you use to define and initialize an array of doubles named ga
    12·1 answer
  • 9.19 LAB: Words in a range (lists) Write a program that first reads in the name of an input file, followed by two strings repres
    6·1 answer
  • Tại sao xe chỉ sản xuất ra 1996cc mà không phải là 2000cc?
    6·2 answers
  • Help me pls...
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!