1006297 wrote:Sometimes "no rows selected" is the correct result. For example, if you suspect that somebody accidentally entered a negative number in the teams.TeamNo1_ID column, you might say
I want to know how to select rows whilst putting in an execution command at the end where all my tables are created and data are inserted following the relations with tables, except ... when I try to enter a certain command it gives me "no rows selected" option does anyone know the solution for that cause I basically am selecting the rows but it for some reason doesn't actually SELECT !
and you'd be happy to see "no rows selected".
SELECT TeamNo1_ID FROM teams WHERE TeamNo1_ID < 0;
this is my entire sql code:Be careful! You mis-spelled the table names. (This has nothing to do with "no rows selected", of course.)
CREATE TABLE CLUBS(
CREATE TABLE CLUBOWNERS(
(from this part on I have errors basically I want to run these queries but for some reason I don't know for some what to input take the first query as an e.g. and also the rest tell me that "no rows are selected" !) Can someone please tell me a possible solution for this !In the players table, there's no column called PlayerPosition_ID. Did you mean PPosition_ID?
SELECT * FROM PLAYERS WHERE PlayerPosition_ID = &PlayerPosition;
SQL*Plus substitutes the value you type (such as 150) for the variable (&PlayerPosition) before sending the code to the database to be run.
SELECT * FROM PLAYERS WHERE PPosition_ID = 150;
SELECT MAX (NoOfWins) FROM TEAMS;I get 60 when I run the query above. Even if there were no rows in the teams table, this query would never produce "no rows selected". Are you sure that's the result you're getting from this query?
SELECT Match_ID,MDate,MLocation FROM MATCHES WHERE Match_ID IN (SELECT Match_ID FROM MATCHES HAVING SUM(NoOfFouls) >15 GROUP BY Match_ID);"No rows selected" is the correct answer for the query above. That doesn't mean that there is anything wrong wioth the tables; you simply asked to see rows that met a certain condition, and no rows happened to meet it. You asked to see some information about matches where more than 15 fouls occurred, but in the sample data, the highest number of fouls in any match happens to be 10, so there really are no rows with more than 15.
SELECT MAX (Experience) FROM PLAYERS;I get 9 when I run the query above. Again, whenever you use an aggregate function (such as MAX, above) and no GROUP BY clause, the query will always produce 1 row of output, regardless of what's in the table. If you're getting "no rows selected", then I don't think you're running the query above.
SELECT * FROM (SELECT FName, COUNT(InterM, NatM) FROM PLAYERS GROUP BY PlayerNo1_ID ORDER BY COUNT(InterM, NatM) DESC) WHERE rownum = 1I get "ORA-00909: invalid number of arguments" when I run the query above. The COUNT function takes exactly 1 argument, but you're calling it with 2 arguments (InterM and NatM). Also, you can include FName in the SELECT clause unless it's in the GROUP BY clause, too. The following query runs:
But it might not do what you want. (I don't know what you want, so I can't tell.)
SELECT * FROM ( SELECT PlayerNo1_ID , FName , COUNT (InterM) AS InterM_cnt , COUNT (NatM) AS NatM_cnt FROM PLAYERS GROUP BY PlayerNo1_ID , FName ORDER BY COUNT (InterM) DESC , COUNT (NatM) DESC ) WHERE rownum = 1 ;
PS: I also want to know if anybody knows how I can do these points in general:It looks like these 5 separate questions, which have nothing in common except that they use some of the same tables (and perhaps were all on the same homework assignment). You should open 5 separate threads, one for each separate question. Post the relevant CREATE TABLE and INSERT statements, along with the desired results, in each thread.