How many rows in the following SELECT statement will return a null prerequisite?
SELECT prerequisite, COUNT(*)
FROM course
WHERE prerequisite IS NULL
GROUP BY prerequisite;
|
None |
||
|
One |
||
|
Multiple |
Answer
One
Explanation :
As we are retrieving prerequisite from the table course by grouping it by prerequisite, it will group all the null prerequisite together in to a single row and only one row will be returned. So, only one row in the above SELECT statement will return a null prerequisite.
Group by command groups all the rows having same values in to a single row. In the same way, all the rows having null values are grouped together in a single row.
How many rows in the following SELECT statement will return a null prerequisite? SELECT prerequisite, COUNT(*)...
K P G 1 0 red 2 NULL red 3 0 blue 4 9 red 5 NULL blue Table T has 5 rows of 3 columns of data as shown above, where NULL means no data. The following statement SELECT P, COUNT(*) as Total FROM T GROUP BY P; should return a table containing a.) zero row b.) one row c.) two rows d.) three rows
QUESTION 32 Which statement can be used for conditional queries equal to if-then-else CASE WHERE DISTINCT DECODE 2.5 points QUESTION 33 The GROUP BY clause comes before the ORDER BY clause True False 2.5 points QUESTION 34 In the statement: SELECT Order_Item from orders o where order_id=1001; the "o" is a column alias table alias part of the column name a join operator 2.5 points QUESTION 35 Include which clause to this statement to return the null...
#6 Write a SELECT statement that returns these columns: The count of the number of orders in the Orders table The sum of the tax_amount columns in the Orders table Write a SELECT statement that returns one row for each category that has products with these columns: The category_name column from the Categories table The count of the products in the Products table The list price of the most expensive product in the Products table Sort the result set so...
/* (5) Question #2: Fix the following query. It should return 13 rows, first one is "USB food flash drive - banana" */ SELECT SI.StockItemID, SI.StockItemName AS [ItemForSales], SI.ColorID AS [Color] FROM Warehouse.StockItems SI ORDER BY ItemForSales WHERE SI.ColorID = NULL AND SI.StockItemName LIKE '%USB%' my error : Msg 156, Level 15, State 1, Line 12 Incorrect syntax near the keyword 'WHERE'. What is causing my error?
Which of the following is a correct statement of the null hypothesis? Select one: a. There are no true differences between the groups. Any difference found is due to sampling error. b. There is a statistically significant difference between one group and another. c. The observed differences were created by bias. d. There is a positive direct correlation between one group and another.
1.What is the return value if the user try to do the
following:
SELECT TRUNC (65.73,-2) FROM DUAL;
Select one:
a. 60
b. 00
c. 0
d. 600
2.Supposed that the user uses the ff SELECT statement: what will
be the possible output.
SELECT GRADE AS STUDENT MARK
FROM GRADE_REPORT;
Select one:
a. Error because of the keyword AS.
b. Error because of missing “” mark.
c. Will display the column GRADE rename as STUDENT MAK
d. Will display all...
For the following question: In a table called AllColors there are columns called Colors and ColorName. In another table called Items there are columns called ItemID, ItemName, SupplierID, and the connecting column which Colors. Return the Colors, ColorName, and the count items for each color. And order results by the count, DESC, I have the following answer: SELECT Colors, ColorName, COUNT(*) as cnt FROM AllColors A, Items I WHERE A.Colors = I.Colors GROUP BY Colors, ColorName ORDER BY cnt DESC;...
What will the following SQL script return? /* SELECT* FROM EMPLOYEES WHERE TYPE = 'CASHIER' */ A It will return all rows and columns from the EMPLOYEES table. B It will return the CASHIER column for all rows in the EMPLOYEES TABLE. C It will return all rows and columns from the EMPLOYEES table where the TYPE column = "CASHIER". D It will return nothing.
5. Write a SELECT statement that returns these columns from the Orders table: OrderID OrderDate ShipDate Return only the rows where the ShipDate column contains a null value. 6. Write a SELECT statement that returns all columns from the Addresses table State is equal to CA 7. Write a SELECT statement that returns all columns from the Products table Product name has a "ru" in its name 8. Write a SELECT statement that returns these columns from the Customers table...
I can’t figure out how to combine the results from one select statement with the results from another so that the results are side by side. Using Union causes the results of the second statement to add rows below the first results. The first select has sales_rep_id and number_of_customers. The second select has total_number_of_parts and total_customer_sales. I had to create ‘null as’ statements to create the proper columns in each of the statements so that the results from the second...