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;
However, it is almost correct, I should be getting 36 rows, but I'm only getting 7. there are null colors. and when I add the following in the where clause I get 36 rows but the results are incorrect, (WHER A.Colors = I.Colors OR (I.Colors IS NULL))
PLZ HELP!
SELECT A.Colors, ColorName, COUNT(*) as cnt
FROM AllColors A, Items I
WHERE A.Colors = I.Colors
GROUP BY A.Colors, ColorName
ORDER BY cnt DESC;
If any results are incorrect, please provide table data for better output...
Let me know if you have any clarifications. Thank you
For the following question: In a table called AllColors there are columns called Colors and ColorName....
In a table called Sales, there are columns named Quantity and StockID. In another table named Items there are columns named StockID, which is the connecting column to the other table, ItemID, and ItemName. Write a query that returns the ItemID, ItemName, and the average, min, and max quantities for all stock items. And sort the results by average quantity, DESC TSQL
Answer the following SQL study guide questions... Question 1 (1 point) Unless you assign a column name in the base table. the column name in the result set is the same as the 1) unique syntax 2) column alias 3) qualification 4) all of the above Question 2 (1 point) Which clause specifies the number of rows that should be skipped before rows are returned from the result set? 1) FETCH 2) OFFSET 3) FIRST 4) NEXT Question 3 (1...
Using the Cash table below, show the output for the following SQL query: (Using the dropdowns, identify which rows and columns would included in the SQL query output shown below. Select "Not included" for rows and columns that would not be included in the output.) SELECT Account#, Balance FROM Cash WHERE Bank = ‘Boston5’ ORDER BY Amount DESC; Cash Account # Type Bank Balance 253 48.000 75,000 950 Checking Checking Draft Checking ncluded BA-6 BA-7 ot Included BA-8 BA-9 Boston...
1. Use the data in the contingency table to answer the question. Columns Rows 1 2 3 Total 1 36 35 92 163 2 67 57 113 237 Total 103 92 205 400 You wish to test the null hypothesis of "independence"—that the probability that a response falls in any one row is independent of the column it falls in—and you plan to use a chi-square test. You are given that there are 2 degrees of freedom associated with the...
Which SQL statement retrieves the EmployeeName and City columns from the Employees table? O LIST EmployeeName, City ON Employees; O FIND EmployeeName, City ON Employees; SELECT EmployeeName, City FROM Employees; O RETRIEVE EmployeeName, City FROM Employees; Which SQL statement finds the different cities in which national parks reside with no duplicate rows listed? SELECT DISTINCT city FROM natlpark ORDER BY city; O ORDER BY natlpark DISTINCT city; O ORDER BY city FROM natlpark; O SELECT city FROM natlpark ORDER BY...
For this problem, assume salesperson data are stored in a database table named staff. Also assume the columns in the table are named name, carsSold, and totalSales Write a Python function named getSalesSortedByNames. Your function will have 2 parameters. The first parameter is a database cursor and the second parameter is a float. Your function should start by retrieving those rows in the staff table whose totalsales field is equal to the second parameter. (The next paragraph shows the Python...
I need help with certain questions. Please. 18. 4 points For each Rental, list the Rental ID, Rental date, customer ID, customer first name, customer last name, and count of disks rented; sort by Rental ID. Show the Rental date formatted as ‘mm-dd-yyyy.’ Hint: use a GROUP BY clause. 19. 4 points List the disk ID, title name, rating, format description, and fee amount for all copies rented in Rental 3; sort by disk ID. Show the fee amount formatted...
Question 9 (1 point) Which choice below describes the function of the following SQL statement? SELECT ID, Last Name, First Name, Address FROM Members WHERE Last Name Last Name a simple query a parameterized query a compound query a wildcard query Question 10 (1 point) The correct SQL syntax to sort a table by Last Name in order of A-Z is SORT BY Last Name ASCENDING ORDER BY Last Name Down ORDER BY Last Name ASC ORDER BY Last Name...
4. Columns is a video game available on the Sega Gen- esis system. In the flashing version of the game, the player attempts to capture a flashing block in the bottom row of the screen as quickly as possible. The game may be played at levels 2 through 9. The level denotes the number of complete rows of blocks on the screen at the beginning of the game. For example at level 2 the player must break through the second...
Question 1) Suppose a program has the following code: const int X = 2, Y = 3; int sum; int values[X][Y] = {{1, 2, 3}, {4, 5, 6}}; for(int i=0; i<X; i++) { sum=0; for(int j=0; j<Y; j++) sum+=values[i][j]; cout<<sum<<endl; } What is this program getting the sum of? Group of answer choices D-) The columns of the 2D array C-) The rows of the 2D array A-) All of the elements of the 2D...