Select data from database [closed] - mysql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I want to load data from database but how to get data in specific colmun
More Explanation:
lets say that we have a table called players, Then we have three columns "Username, Password and E-mail"
Now, if we want to select the email of the player who called "Nezo" how we can do it ?

This is a straightforward SELECT statement. I'd take some time to familiarize myself with the MySQL manual on SELECT, since it is among the most basic MySQL commands.
In this case, our select_expr (SELECT expression) is going to be the column from the table we're looking for, E-mail, and we're going to need to restrict the query to only look at the e-mail of the user named 'Nezo' using a WHERE clause:
SELECT `E-mail` FROM `players` WHERE `Username` = 'Nezo';

Related

joining 2 tables without duplicates [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am trying to join an old sql table with a new one but exclude the duplicate entries, this needs to be in a delphi program as well, and im a noob at that, any ideas?
These both keywords will make your data to combine and display in a single column.
Union - Removes the duplicate entries of the table
Union All - Includes the duplicate entries
It would be better if you provide an example with input and output, that would clarify your question the most.
you can use the union all operator instead of the union operator for joining two tables that not remove duplicates from the table.

Know if theres a phone number in a string [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 days ago.
Improve this question
I have a table with a column called 'description' which is the description of an ad, and i want to know how many ads include the seller phone number in the description.
for example:
'car for sale. Toyota Corolla. Call 0759485102'
(all phone numbers have 10 digits)
how can i query that? im using mysql in datagrip
Most databases support regular expressions -- at least sufficiently to start to answer this question. You can look for a 10-digit string. There is no way to know if this is really a telephone number (unless you have that somewhere else).
For instance, in MySQL, you can do:
select count(*) as num_with_10digits
from t;
where description regexp '[0-9]{10}';
The where clause differs by database, but the idea would be the same in most databases.
You can use like predicate :
select count(*)
from table t
where description like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]';

How to retrieve userID from table [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a table named 'User' and it has an autoincremented field userID.
I want to retrieve that userID in my servlet. There is no such parameter/field referred to on that respective HTML. How can I use that userID in my servlet?
I would say your question is far to broad for a definite answer mate but here goes my best guess.
I assume you run this table and data in mysql since you tagged this as mysql.
you can retrieve the data you wish with the query as below:
SELECT userID FROM User;
Note: If you have more than 1 this will return all of them. If you want to limit this down to 1 you will need to match that to another unique parameter in your table. For example lets say you have a column in User table called "telephone"
the query would be:
SELECT userID FROM User WHERE telephone = '1234567890';
You can then display the result in your html, depending on what language you use to execute this query with.
Hope this helps

Is there a way to make a VIEW statement in MS Access? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I had a table named table1 and have a three column.. column1, column2,column3..
I want to view the value of my columns in table using VIEW statement not SELECT is it possible?
Thank in advance#
No. View is a SQL database concept. You will have to use SELECT... to create a query, which is essentially the same thing. MSAccess has no concept of Views, it uses Queries.
A view is an SQL query that has been given a name and stored in the database. That is exactly what the Access queries are.

Alternative method for using DISTINCT in mySQL [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I retrieved records from Sphinx index through DISTINCT method using sphinx for large number of records...For the backup I'm going to retrieve data from mySQL for bulk records..
Is the same DISTINCT query works well for the mySQL table also..Or is there any other way for retrieving data from mySQL instead of DISTINCT for getting data from large data table without time delay...
If indexed, there isn't a difference between distinct and group by, some would argue that Distinct doesn't have to sort, however you can get this as well with the group by, if you order by null in mysql, so I would say they aren't different at all.
However, perhaps I am missing the question all together.