Knowee
Questions
Features
Study Tools

Question 5When querying a table called Teachers that contains a list of teachers and the city they teach in, which of the following queries will return the number of teachers from each city?1 pointSELECT distinct(City) FROM Teachers SELECT City, count(City) FROM TeachersSELECT City, count(City) FROM Teachers GROUP BY CitySELECT City, distinct(City) FROM Teachers GROUP BY City6.Question 6You want to retrieve a list of employees by first name and last name for a company that are between the ages of 30 and 50. Which clause would you add to the following SQL statement: SELECTFirst_Name,Last_Name, Age FROM Company1 pointWHERE Age > 30IF Age >=30 AND Age <=50WHERE Age < 30WHERE Age >=30 AND Age <=50

Question

Question 5When querying a table called Teachers that contains a list of teachers and the city they teach in, which of the following queries will return the number of teachers from each city?1 pointSELECT distinct(City) FROM Teachers SELECT City, count(City) FROM TeachersSELECT City, count(City) FROM Teachers GROUP BY CitySELECT City, distinct(City) FROM Teachers GROUP BY City6.Question 6You want to retrieve a list of employees by first name and last name for a company that are between the ages of 30 and 50. Which clause would you add to the following SQL statement: SELECTFirst_Name,Last_Name, Age FROM Company1 pointWHERE Age > 30IF Age >=30 AND Age <=50WHERE Age < 30WHERE Age >=30 AND Age <=50

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

To answer Question 5, the correct query to return the number of teachers from each city is:

SELECT City, count(City) FROM Teachers GROUP BY City

To answer Question 6, the clause you would add to the SQL statement is:

WHERE Age >= 30 AND Age <= 50

Similar Questions

Question 2A DEPARTMENTS table contains DEP_NAME, and DEPT_ID_DEP columns and an EMPLOYEES table contains columns called F_NAME and DEP_ID. We want to retrieve the Department Name for each Employee. Which of the following queries will correctly accomplish this?1 pointSELECT D.F_NAME, E.DEP_NAME FROM EMPLOYEES E, DEPARTMENTS D WHERE D.DEPT_ID_DEP = E.DEP_IDSELECT F_NAME, DEP_NAME FROM EMPLOYEES E, DEPARTMENTS D WHERE E.DEPT_ID_DEP = D.DEP_IDSELECT F_NAME, DEP_NAME FROM EMPLOYEES, DEPARTMENTS WHERE DEPT_ID_DEP = DEP_IDSELECT E.F_NAME, D.DEP_NAME FROM EMPLOYEES, DEPARTMENTS

2 pointsUsing the table Students, choose the correct SQL statement that will return the resultant table given in Figure 2.SELECT Age, Country, COUNT(*) FROM Students GROUP BY Name;SELECT Age, Country, COUNT(*) FROM Students GROUP BY Age, Score;SELECT Age, Country, COUNT(*) FROM Students GROUP BY Age, Country;SELECT Age, Country, COUNT(*) FROM Students GROUP BY Score, Country;

Students Table Surname   First_Name   Student_No   Dept_No   Year Duke Fitzroy 1 4 2Al-Essawy Zaid 2 4 2Ayton Phil 3 3 1Patel Mahesh 4 2 1Jones Gareth 5 2 1Scott Gavin 6 2 2CREATE VIEW Freshman     AS Select * From Students Where Year = 1;Considering the above Students table and Freshman view, what will be the result of the following SQL query:Select * From Freshman Where Dept_No=4;Question 6Select one:a. Surname   First_Name   Student_No   Dept_No   Year Ayton Phil 3 3 1Patel Mahesh 4 2 1Jones Gareth 5 2 1b. Surname   First_Name   Student_No   Dept_No   Year Duke Fitzroy 1 4 2Al-Essawy Zaid 2 4 2c. Surname   First_Name   Student_No   Dept_No   Year Duke Fitzroy 1 4 2d.None of the above

4. What is the SQL to do this result?

Which of the following SQL statements can extract employee name’s whose salary is $10000 or higher from the table “human_resource”? SELECT employee_name, COUNT(*) FROM human_resourceWHERE salary>=10000 GROUP BY employee_nameSELECT employee_name FROM human_resourceWHERE salary>=10000SELECT employee_name, salary FROM human_resourceGROUP BY salary HAVING COUNT(*)>=10000SELECT salary FROM human_resourceWHERE employee_name >=10000 GROUP BY salary

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.