Question
Easy SQL questions, Will upvote: Identify the SQL that answers each of the following questions: For each answer, add a comment line right before it
Easy SQL questions, Will upvote:
Identify the SQL that answers each of the following questions:
For each answer, add a comment line right before it with the question such as:
/* What pets are in the database?*/
Select Name From PET;
-----------------------------------------------
Identify the SQL that answers each of the following questions:
Projection:
What pets are in the database?
What are the names of the pets in the database?
What are the ID numbers and breeds of the pets in the database?
What are the names, species, and breeds of the pets in the database?
What are the names, genders, and altered status of the pets in the database?
Restriction:
What dogs are in the database?
What cats are in the database?
What rabbits are in the database?
What pets are female?
What pets are male?
Function:
What is the total number of scores received for the tests taken?
What is the sum of the scores of the tests taken?
What is the average of the scores of the tests taken?
What is the lowest score of the tests taken?
What is the highest score of the tests taken?
Group By:
What is the total number of scores received by each student?
What is the total number of scores received for each test?
What is the sum of the scores for each student?
What is the average score for each test?
What is the average score for each student?
What is the lowest score received for each test?
What is the lowest score received by each student?
What is the highest score received for each test?
What is the highest score received by each student?
Having:
What is the total number of scores for each test with a total score of at least 200?
What is the total number of scores for each student with a total score of at least 200?
What is the total number of scores for each student who has taken exactly three tests (ie has 3 scores)?
What is the total number of scores for each test that has been taken by exactly 3 students (ie has 3 scores)?
What is the average score for each test which has received exactly three scores (ie taken by 3 students)?
What is the average score for each student with exactly three scores (ie taken 3 tests)?
What is the lowest score for each test with exactly three scores (ie taken by 3 students)?
What is the lowest score for each student with exactly three scores (ie taken 3 tests)? What is the highest score for each test with exactly three scores (ie taken by 3 students)?
What is the highest score for each student with exactly three scores (ie taken 3 tests)?
Distinct:
What are the names of all of the different pets in the database?
What are the distinct names of the pets in the database?
What are the species of all of the different pets in the database?
What are the distinct species of the pets in the database?
What are the genders of all of the different pets in the database?
What are the distinct genders of the pets in the database?
What are the genders and altered status of all of the different pets in the database?
What are the distinct genders and altered status of the pets in the database?
Order By:
Who are the pets in the database, sorted by ID number?
Who are the pets in the database, sorted by name?
Who are the pets in the database, sorted by name, in reverse order?
What are the names, species, and breeds of the pets in the database, sorted by ID number?
What are the names, species, and breeds of the pets in the database, sorted by name?
What are the names, species, and breeds of the pets in the database, sorted by name, in reverse order?
What are the names of the pets in the database, sorted by ID number?
What are the names of the pets in the database, sorted by name?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started