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
How can an administrator make only the files and folders to which a user has at least Read permissions visible?
BigorU [14]

Answer:

By enabling the Access-Based Enumeration (ABE)

Explanation:

Access Based Enumerator (ABE) is a Microsoft Windows protocol which filters the list of available files and folders on a server to only include those that the user requesting for access has read access to.

If a user does not have Read (or equivalent) permissions for a folder, Windows hides the folder from the user's view

5 0
3 years ago
How can i get google assistant on my lava iris 820 smartphone easily???? ​
Free_Kalibri [48]

Google assistant on my lava iris 820 smartphone in the following way.

Explanation:

Google Assistant on your smartphone, here’s a complete ready to use guide

How to download and install Google Assistant

  • Most of the Android smartphones today come with Google Assistant pre installed and if it is not there.You can download it from Google Play Store.Apple iphone/ipad user installed it fro the App store.

How to set up google assistant .

  • Turn the Google Assistant on or off
  • On your Android phone or tablet, touch and hold the Home button or say "OK Google" or "Hey Google."
  • In the bottom right, tap .
  • In the top right, tap your Profile picture or initial Settings. ...
  • Under "Assistant devices," select your phone or tablet.
  • Turn Google Assistant on or off.

Link your voice

To use Voice Match, you must link a Google Account to the Google Assistant device. If you have multiple Google Accounts, you can choose which account you want to use.

Open the Google Home app Google Home.

At the bottom, tap Home Home and then Settings Settings.

Under “Google Assistant services,” tap More settings.

Tap Assistant and then Voice Match and then Add devices.

Follow the steps.

When you link your voice and use the Google Assistant in US English, the Google Assistant will automatically acknowledge when you ask it for something politely.

5 0
3 years ago
1.where should the name of the website or company logo appear on a website
Paul [167]

Answer:

1. First Page

2. Two Colors

8 0
3 years ago
Read 2 more answers
Which of these is an example of gathering secondary data?
Soloha48 [4]

Answer:

searching for a chart

Explanation:

:)

7 0
3 years ago
True or False <br><br> Rootkits are only made by black-hat hackers.
andreyandreev [35.5K]

Answer:

True

Explanation:

Rootkits are malicious software that allows an unauthorized user to access a computer and restricted areas of software. Rootkits are difficult to detect on your computer because it may be able to subvert there that is intended to find it. Rootkits are created by Black-hat hackers to attack your computer and steal.

Rootkit tools:

1. Keyloggers

2. antivirus disablers

3. password stealers

4. banking credential stealers

5. bots for DDoS attacks

8 0
3 years ago
Other questions:
  • You have a network of 300 users. You are finding that you must frequently restore files from backup that users have accidentally
    13·1 answer
  • All java classes must contain a main method which is the first method executed when the java class is called upon.
    10·1 answer
  • How many bits would be needed to count all of the students in class today there is 20 students
    6·1 answer
  • What is a file type and why is it important? Give at least three examples of file
    7·1 answer
  • Which option is used to ensure the integrity and authenticity of a Word document but requires additional services to be availabl
    5·2 answers
  • Compare and contrast two fundamental security design principles in network security. Analyze how these principles and how they i
    15·1 answer
  • Will this website ever get itself together to stop people from sending links?
    9·1 answer
  • What is a key differentiator of Conversational Artificial Intelligence (AI)
    11·1 answer
  • When using MakeCode Arcade, what is the easiest way to make modules?
    6·1 answer
  • List seven media features that can be used in media queries.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!