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
Could Anyone Please Explain To Me What Is Supervised Learning In Machine Learning? I encourage that you explain it in simple wor
nadya68 [22]

Answer:

Kindly check Explanation.

Explanation:

Machine Learning refers to a concept of teaching or empowering systems with the ability to learn without explicit programming.

Supervised machine learning refers to a Machine learning concept whereby the system is provided with both features and label or target data to learn from. The target or label refers to the actual prediction which is provided alongside the learning features. This means that the output, target or label of the features used in training is provided to the system. this is where the word supervised comes in, the target or label provided during training or teaching the system ensures that the system can evaluate the correctness of what is she's being taught. The actual prediction provided ensures that the predictions made by the system can be monitored and accuracy evaluated.

Hence the main difference between supervised and unsupervised machine learning is the fact that one is provided with label or target data( supervised learning) and unsupervised learning isn't provided with target data, hence, it finds pattern in the data on it's own.

A to B mapping or input to output refers to the feature to target mapping.

Where A or input represents the feature parameters and B or output means the target or label parameter.

4 0
3 years ago
In an ipv4 address, what are the maximum number of bits that can be used to identify the network address
Solnce55 [7]
Up to 24 bits can be used to identify unique <span>networks.</span>
5 0
3 years ago
Troy, an aspiring screenwriter, aspires to work with a famous director known for his philanthropic work. Troy gets an appointmen
kicyunya [14]

Troy should include a short overview of the story that his video will tell and why he wants to tell it (or what the video will be about and why). It should also include the target audience, and where the video will be published.

7 0
3 years ago
Which of these are examples of data sources? Check all that apply.
Rama09 [41]

Answer: databases, electronic archives, online libraries, spreadsheets (B,C,E,F)

Explanation: I just took the test :)) hope u have a great day and remeber u are beautiful <3

4 0
2 years ago
Read 2 more answers
A database is used to _____.
Cloud [144]
A database is used to organize a large collection of data, hence the name database. It is literally a base that would contain a chunk of data that a person or an organization will need to pull out later when they need it. Databases are usually used by companies or organizations
5 0
3 years ago
Read 2 more answers
Other questions:
  • During the past decade ocean levels have been rising faster than in the past, an average of approximately 3.1 millimeters per ye
    14·1 answer
  • Float in is an example of a(n) _____. annotation, evolution, animation, simulation
    14·1 answer
  • When was internet started in which year​
    13·2 answers
  • A digital designer might do computer animation or video games true or false
    13·2 answers
  • Design the logic for a program that allows a user to enter 20 numbers, then displays each number and its difference from the num
    13·1 answer
  • How can forms help us reduce data-entry errors?
    12·1 answer
  • Consider the following code snippet: int count = 0; int[][] numarray = new int[2][3]; for (int i = 0; i &lt; 3; i++) { for (int
    15·1 answer
  • E-mail messages, instant messages (IMs), or text messages sent and/or received within an organization a. are not included on a r
    9·1 answer
  • How do you think Beyoncé choreography has/will influence the future of dance?
    9·2 answers
  • How to scan a screenshot on Brainly?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!