Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Any thoughts on why WHERE clause would not work? I have made sure I have double checked the coding and spelling etc. It will not work with a simple WHERE clause, and I have tried using different operators, operators that I know are in the table. I have tried using trailing spaces, I have copied and pasted the output from SELECT DISTINCT column_name FROM table. In short I have really made sure that it is not just some dumb error on my part before posting this question.
Here are the specs of the column that is giving me trouble. UTF8_General_Ci and it VARCHAR(100).
I have never had any problems with a WHERE clause, not like this at least. Any thought? Thanks in advance
Here is the code;
SELECT site_specialty
FROM site WHERE site_specialty='INTERNAL MEDICINE'
there is no error message, it just comes up blank 0 rows returned
try this
SELECT site_specialty FROM site WHERE site_specialty LIKE '%INTERNAL MEDICINE%'
Before giving up entirely, I would try:
SELECT site_specialty
FROM site
WHERE upper(site_specialty) like '%INTERNAL%MEDICINE%';
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I wrote a simple code to create a table in SQL. It is generating errors I am unable to understand even though I am sure the syntax are correct. Here is the output of my problem in the image:
Your query should be like below :
CREATE TABLE Users (
name varchar(128),
email varchar(128)
)
I highly recommend you to avoid using reserved words like Users.
A guide to help you creating tables.
As far as I get, the SQL syntax uses no curly braces, but just braces.
Have a look at this:
https://www.w3schools.com/sql/sql_create_table.asp
In fact, I would recommend you to use W3 schools for every extremely simple question like this one.
Create Table Users(
Name varchar(50),
Email varchar(100)
);
You should use () this brackets not {} this
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
SQL beginner here. I have this database: https://github.com/socratica/data/blob/master/earthquake.csv
I'm running a simple Query such as:
SELECT place, DEPTH1 , OCCURED_ON from EARTHQUAKE1;
I execute it, and get the info I need. However, when I add WHERE depth1 = 35; (I edited the depth col just in case it was conflicting with some other clause)
the GUI returns an error. I tried adding ' and using like, also using TRIM but no luck. I also tried retrieving data from another col, but still no good. What is it that I'm doing brutally wrong?
Thanks in advance!
You have a semicolon after your FROM and before your WHERE.
SQL is reading the WHERE as a separate statement and failing.
The ; is a statement terminator.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
Hi I am trying to make a very basic sql query from a mysql table.
SELECT VAV,floor from Mapping limit 10;
output is
But when I try with
SELECT VAV,floor from Mapping where floor='B2WL1';
It outputs an empty set. I am very surprised with this. I have also tried with spaces like
SELECT VAV,floor from Mapping where floor=' B2WL1';
SELECT VAV,floor from Mapping where floor='B2WL1 ';
it is returning empty set. Can someone help me with this. Really stuck at this.
try:
where floor like '%B2WL1%';
Probably has whitespaces or any other hidden characters
you may try with wild characters like
SELECT VAV,floor, LENGTH(floor) as number_of_characters
from Mapping
where floor like '%B2WL1%';
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have this table:
Well, When I execute this query:
SELECT * FROM users order by rp_bought desc limit 5
I get no errors but, The username, Raed is in the last place as Raed Has the Most Rp_Bought (1300)
Im Wondering Why is this Problem Occurring.
This would occur if rp_bought were stored as a string rather than as a number. In MySQL you can easily fix this by adding 0:
order by rp_bought + 0 desc
The + 0 is an easy way to convert from a string to a number (with no additional errors occurring).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I have a mysql table with a numbers column, this contains a list of UK mobile phone numbers (beginning in 07) and some UK landline numbers (beginning in 01).
How could I query for just the land line numbers?
I know I could use some kind of regex in my application, but if possible I would rather do it using a query.
Any help would be appreciated!
Select * from MyTable where phoneNumber like '01%';
Try
Select * from `someTable` where `phoneNumber` like '01%';
Use the Like operator in your query. For example "select number from tbl where number Like '01%'"
Try to read something about the WHERE condition and LIKE comparison.
For example here: The SQL LIKE Operator