This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
i have been looking on the web for a few hours and haven't found a clear answer to my problem. is there a mysql command i can use to get the data from a row and a column like Select row 6 column Usernames. is there a simple command i just have been other looking.
As Jeanne says, relational databases do not make any guarantees about the order in which rows are stored in a table or returned by a query. If you want to fetch rows in a particular order, you specify that order using an "ORDER BY..." clause in your query. If you want to fetch a particular row from a table, you tell the database how to identify that row via the WHERE clause. And you tell the database which columns to return for each row by specifying them in the SELECT clause of your query.
And use the LIMIT clause, as Jeanne says, to fetch a certain number of ordered rows at a time.
No more Blub for me, thank you, Vicar.
Joined: Mar 10, 2013
I was looking for a way to check the username and password match is there a better way then to call each row one by one?
This won't compile as rs.next() returns a boolean to say whether there are any rows returned.
Since there will always be one row (and one column) returned for a count, you use
If you are simply checking whether a row exists, and you don't actually want any data from the row, then you could just do "SELECT 1 FROM...". This will return a 1 as soon as a row is found, so it may be quicker than "SELECT COUNT(*)..." which always has to search the whole table (or index) to get the total count, even if there's only one matching row. If you get anything in your result set, you know a matching row was found. If the result set is empty, then you know there is no matching record.